Bug 11386
| Summary: | CSS: :only-child, :only-of-type is applied to all first children | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Niels Leenheer (HTML5test) <info> |
| Component: | CSS | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED DUPLICATE | ||
| Severity: | Normal | ||
| Priority: | P2 | ||
| Version: | 420+ | ||
| Hardware: | Mac | ||
| OS: | OS X 10.4 | ||
| URL: | http://www.css3.info/selectors-test/ | ||
Niels Leenheer (HTML5test)
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.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Nicholas Shanks
*** This bug has been marked as a duplicate of 5468 ***