Bug 11386 - CSS: :only-child, :only-of-type is applied to all first children
Summary: CSS: :only-child, :only-of-type is applied to all first children
Status: RESOLVED DUPLICATE of bug 5468
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 420+
Hardware: Macintosh OS X 10.4
: P2 Normal
Assignee: Nobody
URL: http://www.css3.info/selectors-test/
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-23 03:09 PDT by Niels Leenheer (HTML5test)
Modified: 2007-01-12 09:58 PST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Niels Leenheer (HTML5test) 2006-10-23 03:09:53 PDT
Current behavoir:
The :only-child matches every first child and the :only-of-type selector matches every first child of a new type.

Reason:
The reason for this is that every time a new element is added to the DOM, it is checked to see if it matches one of the CSS selectors. Because the DOM is build one element at a time, every first child is at least for a moment the only child. The same applies to the first element of a certain type. It is at least for a moment the only of that type. 

Proper behavoir:
The :only-child selector should only match elements that are *really* the only child. The :only-of-type selector should only match elements that are *really* the only child of a certain type. Once an element is no longer the only, or the only of a certain type, it should no longer match these selectors.
Comment 1 Nicholas Shanks 2006-11-20 16:18:10 PST

*** This bug has been marked as a duplicate of 5468 ***