[css3-selectors] details of :nth-child() syntax

I found a few issues in the description of the syntax of
:nth-child() in
http://www.w3.org/TR/2005/WD-css3-selectors-20051215/#nth-child-pseudo

I found two cases where the normative description of the syntax
disagrees with the examples given.  I think the intent is pretty
clear from the examples and we should fix the normative text.  In
particular, I propose:

(1) Changing:
  # When <var>a</var>=0, the <var>a</var><code>n</code> part need
  # not be included, so the syntax simplifies to
  # <code>:nth-child(<var>b</var>)</code> and the last example
  # simplifies to <code>:nth-child(5)</code>.
to read:
  # When <var>a</var>=0, the <var>a</var><code>n</code> part need not be
  # included.  When <var>a</var><code>n</code> is not included, the
  # <code>+</code> sign before <var>b</var> (when allowed) may also be
  # omitted.  In this case the syntax simplifies to
  # <code>:nth-child(<var>b</var>)</code> and the last example
  # simplifies to <code>:nth-child(5)</code>.
Without this change, I think the normative text forbids
:nth-child(5), requiring instead that the author write
:nth-child(+5).

(2) Changing:
  # If b=0, then every ath element is picked. In such a case, the b
  # part may be omitted. 
to instead say:
  # If b=0, then every ath element is picked. In such a case, the +b
  # part may be omitted. 
Without this change, it seems like authors would be required to
write :nth-child(2n+) rather than :nth-child(2n).

There are also two issues that I find unclear:

(3) Is -0 allowed as a value for a and/or b?  If so, the sentence:
  # When the value b is negative, the "+" character in the
  # expression must be removed (it is effectively replaced by the
  # "-" character indicating the negative value of b).
should be clarified to say that :nth-child(n+-0) is not allowed.  If
not, the sentence:
  # The a and b values must be zero, negative integers or positive
  # integers.
should probably clarified to say that zero may not be preceded by a
minus sign.

(4) The spec says:
  # If both a and b are equal to zero, the pseudo-class represents
  # no element in the document tree.
When both are zero, the spec technically allows both to be omitted.
This means :nth-child() is the same as :nth-child(0) and
:nth-child(0n) and :nth-child(0n+0).  Is this intentional, or should
it only be possible to omit one and not both (i.e., omitting both
would be a syntax error)?  Either way, I think it should be stated
explicitly.


I have not yet examined which of these are tested in the test suite.

-David

-- 
L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/

Received on Saturday, 8 March 2008 00:18:28 UTC