[css21] NUMBER, PERCENTAGE, DIMENSION tokens and signs

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