RESOLVED DUPLICATE of bug 4812 9840
last-child pseudo-class applied to all elements
https://bugs.webkit.org/show_bug.cgi?id=9840
Summary last-child pseudo-class applied to all elements
Philippe Wittenbergh
Reported 2006-07-10 22:45:07 PDT
The CSS3 :last-child pseudo-class is applied to all elements of a block instead of the last element. I'll attach a testcase in a moment. This equally applies to the :last-of-type pseudo-class. Safari 1.2 and older actually apply this correctly. But it is broken from Safari 1.3 and 2.0 onwards (and in the nightly WebKit builds). (and it is not clear if these pseudo-classes are actually implemented, there is bug 5468 on that).
Attachments
test case (832 bytes, text/html)
2006-07-10 22:49 PDT, Philippe Wittenbergh
no flags
Philippe Wittenbergh
Comment 1 2006-07-10 22:49:20 PDT
Created attachment 9354 [details] test case Interesting observation maybe. While filing in this bug report with another browser, WebKit was hidden. Unhiding it, the testcase painted correctly. Refresh and display was wrong again.
Nicholas Shanks
Comment 2 2006-07-11 01:50:24 PDT
This occurs because the last-* styles are checked as each element is read in (same as all styles) and at that point, each element *is* the last child since nothing has been added after it yet :-) When repainting, the child is no longer last, so all is fine. I have been waiting for a year for hyatt to decide what he wants to do about this, as the khtml solution used too much memory. No solution has yet been proposed though. I think we could get by with just setting the usesSiblingSelectors bit on any :last-* pseudo-class (the bit currently used for ~ selector).
Dave Hyatt
Comment 3 2006-07-11 02:06:10 PDT
Shrug, it's not my job to propose solutions to every problem. Feel free to come up with something that doesn't bloat all nodes by 4 bytes. :)
mitz
Comment 4 2006-12-16 14:26:23 PST
*** This bug has been marked as a duplicate of 4812 ***
Note You need to log in before you can comment on or make changes to this bug.