Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Validity of :nth-*(-n-1) #22

Open
rasamassen opened this Issue Jun 5, 2012 · 4 comments

Comments

Projects
None yet
3 participants
Contributor

rasamassen commented Jun 5, 2012

According to the spec, there's nothing syntactically wrong with this selector, true.

But the spec also says: The value a can be negative, but only the positive values of an+b, for n≥0, may represent an element in the document tree.

The example that follows is: html|tr:nth-child(-n+6) /* represents the 6 first rows of XHTML tables */

Thus, though the syntax is correct, the selector results in no positive values. Browsers (like Chrome, which currently fails this test) don't need to support input that has no representation in the document tree. I feel this selector test (it happens 4 times in the CSS3Test) should be removed as invalid.

Owner

LeaVerou commented Jun 5, 2012

Browsers don't need to support input that has no representation in the document tree.

Is this your personal opinion or part of the spec?

Contributor

rasamassen commented Jun 5, 2012

The second line is a quote from the spec. Only positive values matter in the document tree.

Personal opinion is I'm not sure what value there is in testing things that have no meaning when parsed. What does it matter for the future of CSS if a browser supports a input that is meaningless? (-n-1) can never result in a positive value and thus, according to the spec, will never affect the document tree. Who really cares if a browser supports it? The test is pointless, even if it is syntactically valid.

Owner

LeaVerou commented Jun 6, 2012

Yes, I know that only positive values matter in the document tree. I was asking about the part I quoted.

And yes, values with no representation can often be useful. For example, in feature detection.

Collaborator

deepj commented Feb 24, 2014

I'm in to remove it. At least for me, it doesn't make sense at all even though it's syntactically valid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment