W3C home > Mailing lists > Public > www-style@w3.org > June 2013

Re: [cssom] rules for serializing :nth-child(an+b) drops signs

From: Simon Pieters <simonp@opera.com>
Date: Thu, 13 Jun 2013 11:53:45 +0200
Message-ID: <51B996A9.8080705@opera.com>
To: "L. David Baron" <dbaron@dbaron.org>
CC: www-style@w3.org
On 6/8/13 9:14 AM, L. David Baron wrote:
> Glenn Adams pointed out to me at today's Test the Web Forward event
> in Tokyo that the rules in
> http://dev.w3.org/csswg/cssom/#serializing-selectors for serializing
> :nth-child(an+b) forms drop signs.  This changes the meaning of
> selectors during serialization, which is incorrect.
>
> In particular, this rule:
>
>    #  4. If a is one or minus one and b is zero let the value be "n"
>    #  (U+006E).
>
> omits the sign on a.  There is a semantic difference between
> :nth-child(n) (which matches all elements) and :nth-child(-n) (which
> matches none) that is lost by this rule.
>
> Likewise:
>
>    # 5. If a is one or minus one let the value be "n" (U+006E),
>    # followed by "+" (U+002B) if b is positive, followed by b
>    # serialized as <integer>.
>
> also omits the sign on a.  This loses the semantic difference
> between :nth-child(-n+2) which matches only the first or second
> child, and :nth-child(n+2) which matches all children except the
> first.
>
> -David
>

https://dvcs.w3.org/hg/csswg/rev/f15e37a210a8

http://dev.w3.org/csswg/css-syntax/#serializing-anb seems to not have 
the problems mentioned above. (I could put this in CSSOM instead if 
that's better.)

-- 
Simon Pieters
Opera Software
Received on Thursday, 13 June 2013 09:52:53 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:12 UTC