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

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