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

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

From: L. David Baron <dbaron@dbaron.org>
Date: Sat, 8 Jun 2013 16:14:37 +0900
To: www-style@w3.org
Message-ID: <20130608071437.GA3958@crum.dbaron.org>
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

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:30 UTC