W3C home > Mailing lists > Public > www-style@w3.org > April 2012

[css21] NUMBER, PERCENTAGE, DIMENSION tokens and signs

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 23 Apr 2012 15:13:54 -0700
Message-ID: <CAAWBYDBEZdOM35cacVNBKvfk3opbBGLwnEAZ7zNw2r_OYir-Uw@mail.gmail.com>
To: www-style list <www-style@w3.org>
Right now, the 2.1 grammar defines NUMBER, PERCENTAGE, and DIMENSION
tokens as starting with a digit or period.  The optional + or - sign
is tokenized as a separated DELIM token, and is combined with the
following token during parsing.

This implies that you can insert a comment between the sign and the
number.  In other words, "-2" and "-/*foo*/2" will both parse as the
number "negative two".  This, in addition to being silly, isn't
interoperable - Firefox  and PrinceXML both parse the sign as part of
the NUMBER/etc token.   (Other browsers follow the spec, as far as we
can tell.)

The current grammar makes it somewhat annoying to talk about numbers
and such in grammar terms, because you must always remember to also
allow an optional + or - DELIM preceding it.

We propose amending the Core Grammar to make the + and - part of the
"num" production.  This shouldn't have any effect on real pages - we
highly doubt that any page has actually put a comment between a
negative sign and the number.

~TJ and fantasai
Received on Monday, 23 April 2012 22:14:43 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:13 UTC