W3C home > Mailing lists > Public > www-style@w3.org > June 2012

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

From: Kang-Hao (Kenny) Lu <kennyluck@csail.mit.edu>
Date: Fri, 08 Jun 2012 04:07:26 +0800
Message-ID: <4FD109FE.5020706@csail.mit.edu>
To: "Tab Atkins Jr." <jackalmage@gmail.com>, Lea Verou <leaverou@gmail.com>
CC: www-style list <www-style@w3.org>
(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

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

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:00 UTC