- From: Tim Bagot <tsb-w3-style-0002@earth.li>
- Date: Mon, 26 Feb 2001 09:24:50 +0000 (UTC)
- To: <www-style@w3.org>
At 2001-02-26T03:59-0000, Sean B. Palmer wrote:-
> Is a forwardslash "/" an allowed part of a CSS2 IDENT? For example:-
>
> .a/bc { font-weight: bold; }
>
> or does it have to be escaped as in:-
>
> .a\/bc { font-weight: bold; }
The relevant productions are:-
ident {nmstart}{nmchar}*
nmstart [a-zA-Z]|{nonascii}|{escape}
nmchar [a-z0-9-]|{nonascii}|{escape}
nonascii [^\0-\177]
unicode \\[0-9a-f]{1,6}[ \n\r\t\f]?
escape {unicode}|\\[ -~\200-\4177777]
This suggests: that the first character of an IDENT must be an alphabetic
ASCII character, or a non-ASCII character, or escaped; that each
subsequent character must be an alphanumeric ASCII character (the
tokeniser is not case sensitive) or '-', or a non-ASCII character, or
escaped; that ASCII characters other than space, dash and tilde may not be
escaped simply by prepending a backslash - a Unicode escape must be used
instead; and that a *single* (unescaped) whitespace character following a
Unicode escape will be ignored.
Therefore, in the example above, the selector should be:-
.a\2F bc
or
.a\00002Fbc
The latter seems less likely to be misinterpreted by a broken parser.
Tim Bagot
Received on Monday, 26 February 2001 04:25:01 UTC