Bug 11384 - CSS2/3: Selectors are not re-evaluated after dynamically updating the DOM (Acid3 bug)
Summary: CSS2/3: Selectors are not re-evaluated after dynamically updating the DOM (Ac...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Nobody
URL: http://www.css3.info/selectors-test/
Keywords: HasReduction
: 9983 16706 (view as bug list)
Depends on: 17143
Blocks: 11390 Acid3
  Show dependency treegraph
 
Reported: 2006-10-23 02:43 PDT by Niels Leenheer (HTML5test)
Modified: 2008-02-21 22:19 PST (History)
6 users (show)

See Also:


Attachments
Minimal test case (531 bytes, text/html)
2008-01-29 00:32 PST, Robert Blaut
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Niels Leenheer (HTML5test) 2006-10-23 02:43:41 PDT
After the DOM is modified the CSS selectors should be re-evaluated. 
Affected selectors: :first-child, :last-child, :only-child, :first-of-type, :last-of-type, :only-of-type, :empty

For example: an element that used to be empty would match the :empty selector. If the update added a new child to that element, it should no longer match  the :empty selector. 

Another example: an element that is the only child of its parent would match the following selectors: :first-child, :last-child, :only-child, :first-of-type, :last-of-type and :only-of-type. If we modify the DOM and append another child of the same type, the original element would only match the :first-child selector.
Comment 1 Mark Rowe (bdash) 2007-01-07 02:50:10 PST
I believe there an existing bug which may already cover this issue, but I can't find it in my quick skim through Bugzilla.
Comment 2 Robert Blaut 2008-01-29 00:32:11 PST
Created attachment 18758 [details]
Minimal test case

I've created minimal test case for this bug based on CSS3 Selectors test suite.
Comment 3 Robert Blaut 2008-01-29 00:54:36 PST
(In reply to comment #1)
> I believe there an existing bug which may already cover this issue, but I can't
> find it in my quick skim through Bugzilla.

After searching I've found three reports similar to this bug: bug 12519, bug 12520, bug 16706. 

Comment 4 Robert Blaut 2008-01-29 04:42:37 PST
*** Bug 16706 has been marked as a duplicate of this bug. ***
Comment 5 Robert Blaut 2008-01-30 14:37:36 PST
Found another similar bug 9983.
Comment 6 Robert Blaut 2008-01-30 15:06:19 PST
Interesting behavior regarding test case found by Alexey:

1. Open the test case in a new tab in background.
2. Don't activate the background tab unless it loads completely.
3. Switch to the background tab and you see the test case passed.

IMO this behavior is caused by the fact that styles are applied when the page becomes visible (not earlier). So the styles are applied on modified DOM tree. The styles don't need to be re-evaluated.

Comment 7 Dave Hyatt 2008-02-02 02:49:13 PST
This has been taken care of.

Comment 8 Robert Blaut 2008-02-21 22:19:21 PST
*** Bug 9983 has been marked as a duplicate of this bug. ***