W3C home > Mailing lists > Public > www-style@w3.org > March 2008

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

From: L. David Baron <dbaron@dbaron.org>
Date: Sun, 9 Mar 2008 14:38:02 -0700
To: www-style@w3.org
Message-ID: <20080309213802.GA31541@ridley.dbaron.org>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:02 GMT