Re: [css3-selectors] Valid syntax that never represents an element

(12/06/08 1:40), Tab Atkins Jr. wrote:
> Yup, Bjoern's right - considering ":nth-child(-n-1)" as an invalid
> selector is definitely wrong, unless the spec actually says that's
> invalid.

(12/06/08 0:35), Lea Verou wrote:
> I think it's quite obvious that throwing an error on such cases is
> non-conforming, since the syntax is perfectly valid according to the
> grammar,

The spec here is contradictory. The formal grammar says :nth-*() can't
have IDENT in it[1], while there's also a sentence

  # When a=1, or a=-1, the 1 may be omitted from the rule.

. "-n-1" is an IDENT.


The spec can't really provide a guideline for this case.

(12/06/08 0:35), Lea Verou wrote:
> If not, it might be a good idea to make it more clear in
> css4-selectors since, apparently,

This part just has to be fixed in css4-selectors.

> implementors are confused too.

Not quite, as far as I can tell. It is fixed in WebKit recently[2], and
I think the reason that this wasn't fixed wasn't because implementors
were confused but because this is sort of an edge case. (At least, they
weren't confused because of the reason you point out as "-1n-1" has been
supported for years.)

For the test case, I think it's actually better to keep it as WebKit
people discovered this problem from running this test on css3test.com
(nice job!) and removing it might confuse people who later read this bug
on bugzilla.

It might or might not be interesting to mark this test as "invalid" per
Selectors 3. It's not like we don't have "invalid" tests in the
testsuite anyway. The idea here is to tell people that specs are usually
far from perfect and people should get on www-style and join these
efforts about testing :)

[1] See discussions in
http://lists.w3.org/Archives/Public/www-style/2012Apr/0811 , and this
was reported before on the list too.
[2] https://bugs.webkit.org/show_bug.cgi?id=83885


Cheers,
Kenny

Received on Thursday, 7 June 2012 20:07:54 UTC