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

On Saturday 2008-03-08 23:27 +0100, Daniel Glazman wrote:
> I think we already discussed that point years ago, and
> if I recall correctly, the resolution at that time was that
> we wanted to benefit from existing CSS tokenization.
> So in the first part of the argument the "an" part is w/o
> spaces, and the second part "b" is w/o spaces too. So:
>   ( 3n+1 )    OK
>   ( 3 n+1 )   NOK
>   ( 3n +1 )   OK
>   (3n+ 1)     NOK
> This should be reflected in my patch in bugzilla.
> Does it make sense ?


One problem is that you can't really make use of the existing CSS
tokenization for :nth-child(3n-1), since "3n-1" is unfortunately a
dimension with "3" as the number and "n-1" as the unit.  (Your patch
didn't handle any of the xn-b cases.)

I also don't think it makes much sense to authors to allow
whitespace before the +/- but not after it, since it *acts* like an
arithmetic operator, so I'd prefer the rules match for both side.
(In Mozilla's recursive descent parser, it should just be an extra
five lines of code to handle that case if we allowed whitespace on
both sides.)

The other problem is that it doesn't seem to be what anybody has
implemented.  But it hasn't been implemented for very long anywhere,
so I'm not sure how much that matters if implementers can change.


L. David Baron                       
Mozilla Corporation             

Received on Saturday, 8 March 2008 23:09:52 UTC