Errors in CSS1, CSS2 specs (mainly css grammar)

While pursuing the CSS specs I discovered some anomalies. They are listed below.

================

Here is an extract from the CSS1 grammar [1]:

#    unicode         \\[0-9a-f]{1,4}
#    latin1          [¡-ÿ]
#    escape          {unicode}|\\[ -~¡-ÿ]
#    nmchar          [-a-z0-9]|{latin1}|{escape}
#    name            {nmchar}+       
#    "."{name}       {BEGIN(AFTER_IDENT); return CLASS;}

According to this, a number *is* allowed at the start of a class,
since a class consists of a "." followed by a {name} and a {name}
consists of one or more {nmchar} and {nmchar} is any of "-", "a"-"z",
"0"-"9", {latin1} or {escape}. This is not what CSS1 says at the end
of section 7.1 [2]:

#    * in CSS1, selectors (element names, classes and IDs) can contain
#      only the characters A-Z, 0-9, and Unicode characters 161-255, plus
#      dash (-); they cannot start with a dash or a digit; [...]
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
================

CSS1, Appendix B, Paragraph 2 [1]: 

#   It is in some sense, however, still a superset of CSS1: there are
#   additional semantic constraints not expressed in this grammar.

The word "superset" should be "subset".

================

The CSS2 grammar [2] appears to be missing the line returning CLASS
altogether.

================

The last paragraph of the CSS2 grammar says [3]:
 
#   In CSS1, a class name could start with a digit (".55ft"), unless it
#   was a dimension (".55in"). In CSS2, such classes are parsed as
#   unknown dimensions (to allow for future additions of new units). To
#   make ".55ft" a valid class, CSS2 requires the first digit to be
#   escaped (".\55ft")

The final string is incorrect. The correct way of escaping ".55ft" so
that it is a valid CSS2 class is ".\abc 5ft", where "\abc" is whatever
the unicode id for the number "5" is in hexidecimal.

================

The CSS2 errata [4] document has a typo too (!):

# Section 9.2.1
#
#  In the example after the diagram, the HTML fragment "<P>jThis is the
#  content of P.</>" should end instead with the end tag "</P>".

There is a extraneous "j" after the "<P>", which does not appear in
the CSS2 spec.

================

References:
[1] http://www.w3.org/TR/REC-CSS1#appendix-b
[2] http://www.w3.org/TR/REC-CSS1#forward-compatible-parsing
[3] http://www.w3.org/TR/REC-CSS2/grammar.html
[4] http://www.w3.org/Style/css2-updates/REC-CSS2-19980512-errata.html

-- 
Ian Hickson

Received on Sunday, 10 January 1999 21:22:55 UTC