Re: [css3-selectors] whitespace inside :nth-child(an+b)?

On Sunday 2008-03-09 12:10 -0700, fantasai wrote:
> I would like to see it allowed everywhere *except* between "a" and "n",
> i.e. (3 n+5) is illegal.

That seems reasonable to me, except I'd also want to treat the sign
of whichever number comes first as a sign (must be attached to the
number) rather than an operator.  In other words, even though
:nth-child(n - 2) would be legal, I'd prefer than :nth-child(- 2)
were not.  (I don't feel strongly about this, though.)

I'd propose the following spec text to do that:
  # Whitespace is permitted after the "(", before the ")", and on
  # either side of a "+" or "-" that separates
  # <var>a</var><code>n</code> and <var>b</var> parts (when both are
  # not omitted).
  #
  # Legal Examples:
  #   :nth-child( 3n + 1 )
  #   :nth-child( +3n - 2 )
  #   :nth-child( -n+ 6)
  #   :nth-child( +6 )
  # Illegal Examples:
  #   :nth-child(3 n)
  #   :nth-child(+ 2n)
  #   :nth-child(+ 2)

-David

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

Received on Sunday, 9 March 2008 21:38:10 UTC