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

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.


  # 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


𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                           http://www.mozilla.org/   𝄂

Received on Saturday, 8 June 2013 07:15:01 UTC