- From: Thomas Ashe <Thomas.Ashe@Blackbaud.com>
- Date: Tue, 7 Dec 1999 17:38:28 -0500
- To: "'Todd Fahrner'" <fahrner@pobox.com>, "'www-style@w3.org'" <www-style@w3.org>
On Tuesday, December 07, 1999 12:57 PM, Todd Fahrner
[mailto:fahrner@pobox.com] wrote:
<SNIP>
> But I see the problem: you are using an underscore in your class
> selector name. This is illegal, and Netscape is correctly rejecting
> the rule. MSIE is incorrectly recognizing it, leading you to think
> that perhaps Netscape is broken in this regard (as in so many others).
>
> Microsoft has gotten and will continue to get itself into lots of
> trouble with such lenient error-handling. See
> http://www.webstandards.org/css/winie/#Incorrect_Error_Handling .
>
</SNIP>
Todd,
I understand how this is the correct interpretation of the spec, but looking
through the archives, I can find little supporting evidence for why
underscore is not supported.
According to HTML4, <http://www.w3.org/TR/REC-html40/types.html#type-name>,
"ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed
by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"),
colons (":"), and periods (".")."
Of course, CSS says, "In CSS2, identifiers (including element names,
classes, and IDs in <selector.html>) can contain only the characters
[A-Za-z0-9] and ISO 10646 characters 161 and higher, plus the hyphen (-);
they cannot start with a hyphen or a digit. They can also contain escaped
characters and any ISO 10646 character as a numeric code (see next item).
For instance, the identifier "B&W?" may be written as "B\&W\?" or "B\26
W\3F". "
Adding ECMAScript to the mix complicates this as well, since hyphens,
colons, and periods are not allowed in script as identifier names(i.e.
document.all.element_name(or document.element_name in NN)), though the
underscore is.
That leaves us with:
HTML
-_:.
ECMAScript
_(underscore)
CSS
-(dash)
How can a programmer effectively create element IDs that are readable, yet
fit all the specs? OK, I guess you could use syntax like that of
Objective-C, such as elementName, but many programmers are used to using
underscore as a valid character in a variable/object name, and not allowing
it seems like a flaw IMO.
Is there something I missing somewhere that would enlighten me to why this
is an illegal character?
Thanks,
-Tom
P.S. in addition to IE, Mozilla M11 accepts names with an underscore as a
valid selector.
/////////////////////////////////////////////////////////////////////
Tom Ashe Blackbaud, Inc.
Software Engineer 4401 Belle Oaks Drive
mailto:thomas.ashe@blackbaud.com Charleston, SC 29405-8530
http://www.blackbaud.com/ 800 443-9441 FAX:843 740-5412
/////////////////////////////////////////////////////////////////////
Received on Tuesday, 7 December 1999 17:38:40 UTC