W3C home > Mailing lists > Public > www-style@w3.org > January 2008

[CSS2.1] Any hope of fixing HASH #{name} to disallow numeric identifiers?

From: Justin Rogers <justrog@microsoft.com>
Date: Fri, 18 Jan 2008 17:11:04 -0800
To: "www-style@w3.org" <www-style@w3.org>
Message-ID: <00BD06E707F60B4F9D6A3E75C712209D49A88E631E@NA-EXMSG-C104.redmond.corp.microsoft.com>
While going through the W3 CSS validator something along the lines of:

#4 { color: green; }

Doesn't pass with a cryptic error message about CSS1 and CSS2 rules for identifiers, but has no mention of CSS2.1. The CSS2.1 "sample" grammar allows for {name} to be {nmchar}+, which specifically allows digits. A failure when parsing means error recovery as opposed to a rule that might never match (for instance, if #4 is an allowed selector, but is a disallowed id in the document language is much different from #4 being a syntax error). If we truly support only support {ident} then we should change this stuff over so it is obvious the errant use of a numeric value will cause.

It is quite obvious that browsers support {ident} here and not {name}. FireFox will throw out the rules for {name} and won't even show them in the OM. They'll allow rules such as:

#-a
#-_
#_

Etc... which are all clearly written to the {ident} grammar.

Justin [MSFT]
Received on Saturday, 19 January 2008 01:11:19 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:58 GMT