RE: IDs *not* in selectors

sue@css.nu [mailto:sue@css.nu] wrote:
>Perhaps someone could explain what I am missing in trying to reconcile
>this statement from Bert Bos, earlier in this thread:
>
>>Since CSS1 allowed digits, I think we should change the text in 4.1.3
>>to match the grammar (i.e., digits are allowed), rather than
>>vice-versa.
>
>with this comment from the CSS1 grammar (1):
>
>/* There is a constraint on the id and solitary_id that the
>   ** part after the "#" must be a valid HTML ID value;
>   ** e.g., "#x77" is OK, but "#77" is not.  */

CSS1 states, in the comment you quote and in prose, that IDs and classes
should not begin with a digit; however, the actual grammar allows IDs to
begin with a digit.
                         
>Just as I think I almost get close to sort of understanding that,
>initially at least, the intent of CSS1 was _not_ to allow initial
>digits, an apparently conflicting assertion is made by the author of the
>recommendation. 

Indeed, that is the case; however, as Bert and Peter point out, that's not
what the grammar actually says, and it is impossible to "correct the
grammar" without creating an ambiguity between RGB hex values and IDs.

>In short: I cannot find the specific part of the CSS1 recommendation
>which allows digits as the initial character in class names/IDs . Please
>give the reference for the statement, preferably with a direct quote
>from the text of the CSS1 recommednation rather than a reference to the
>CSS1 grammar.

That is not possible.  The legality of leading digits in IDs is established
by the grammar, not the text, and the two are in fact in conflict.

>"Amusingly enough, that would break parsing of colors, eg:
>{ color: #123456; }"
>
>It seems to me that this comment, from the CSS2 grammar (3):
>
>"/*
>       * There is a constraint on the color that it must
>       * have either 3 or 6 hex-digits (i.e., [0-9a-fA-F])
>       * after the "#"; e.g., "#000" is OK, but "#abcd" is not.
>       */"
>
>is intended to address that concern, analogously to the way the first
>comment I quoted from CSS1 is meant to address this 'digit as initial
>character' concern.

I don't quite understand that.  What does the number of digits have to do
with this issue?

-Chris Wilson

Received on Monday, 12 July 1999 11:50:53 UTC