Summary: | CSS3: only-child and only-of-type pseudo-selectors (affects Acid3) | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Timothy Hatcher <timothy> | ||||||||||||
Component: | CSS | Assignee: | Dave Hyatt <hyatt> | ||||||||||||
Status: | RESOLVED FIXED | ||||||||||||||
Severity: | Normal | CC: | bdakin, cgriego, gabe, hyatt, ian, info, joost, Justin, nickshanks, phiw2, webkit | ||||||||||||
Priority: | P2 | ||||||||||||||
Version: | 412 | ||||||||||||||
Hardware: | Mac | ||||||||||||||
OS: | OS X 10.4 | ||||||||||||||
Bug Depends on: | 3442, 4812 | ||||||||||||||
Bug Blocks: | 11390, 13446, 17064 | ||||||||||||||
Attachments: |
|
Description
Timothy Hatcher
2005-10-23 08:46:17 PDT
Joost also just filed a bug asking for the nth- selectors as well. last-child, last-of-type, only-child and only-of-type tests: http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/html/tests/css3-modsel-33.html http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/html/tests/css3-modsel-35.html http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/html/tests/css3-modsel-36.html http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/html/tests/css3-modsel-37.html *** Bug 11385 has been marked as a duplicate of this bug. *** *** Bug 11386 has been marked as a duplicate of this bug. *** *** Bug 11785 has been marked as a duplicate of this bug. *** Created attachment 12999 [details]
patch to *remove* support for these properties
Until such time as a correct implementation can be developed, I believe it would be better to not support these at all rather than to support them incorrectly. The current behaviour of :last-child behaving like a base element selector, and :only-child behaving like :first-child is highly detrimental.
This might not be a bad idea, though I think hyatt would be the best judge. I'll put in my vote for that idea as well since this bug bit me in the ass hard a few months ago. Comment on attachment 12999 [details]
patch to *remove* support for these properties
Yeah, I agree with removing support for these.
You haven't adequately removed them unless the rules are rejected. You need to go further and actually yank the names from the list of pseudo types completely.
For example:
:last-child, div { color: red }
should be rejected since last-child is unrecognized.
Also,
:not(:last-child)
needs to also be rejected. With your patch :last-child just always returns a failed match, which will cause :not(:last-child) to always match.
Created attachment 13032 [details]
lets see if dave likes this one any better
Comment on attachment 13032 [details]
lets see if dave likes this one any better
Patch looks good. Since the tests that are being landed are expected failures, I'd prefer they go under css3/expected_failures/ (as we did with table tests that have failing results), so that there's no confusion about the fact that we're deliberately checking in failing test cases.
I'll r+ once the tests are moved.
(Also changelog typo, I assume you meant "erroneously") Created attachment 13078 [details]
aye aye cap'n!
Comment on attachment 13078 [details]
aye aye cap'n!
r=me
Patch to remove support landed in r19528. Comment on attachment 13078 [details]
aye aye cap'n!
Marking obsolete to get it out of the commit queue.
Comment on attachment 13078 [details]
aye aye cap'n!
Apparently being obsolete doesn't matter to the commit queue... Removing review flag to make it go away.
Acid3, test0 depends on dynamic :last-child support. :last-of-type causes test 39 to fail as well. selectorTest(function (doc, add, expect) { builder(doc); var match = add(":last-of-type"); var values = [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1]; for (var i = 0; i < elements.length; i += 1) expect(elements[i], values[i] ? match : 0, "part 2:" + i); }); i = 7 when we fail. Returning this to unassigned as it's seen no activity from the assignee in 11 months. *** Bug 17155 has been marked as a duplicate of this bug. *** Created attachment 18871 [details]
Implement :only-child and :only-of-type
Created attachment 18872 [details]
Patch
Comment on attachment 18872 [details]
Patch
r=me
Fixed in r29944. |