W3C home > Mailing lists > Public > www-style@w3.org > July 2000

css identifier parsing bugs, escapes in classnames

From: Daniel W. Connolly <connolly@w3.org>
Date: Wed, 19 Jul 2000 03:54:49 -0400
Message-Id: <200007190754.DAA15801@tux.w3.org>
To: css-test@w3.org, www-amaya@w3.org, www-style@w3.org
The text of the paragraph in the following document
should be purple, no?

--8<--8<--
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>test</title>
<style type="text/css">
p.a\:b { color: purple }
</style>
</head>
<body>
<p class="a:b">aslkfj</p>
</body>
</html>
--8<--8<--

HTML 4 doesn't exactly say what the syntax of a class name
is:

"class = cdata-list [CS] 
                This attribute assigns a class name or set of class names to an element. Any number of elements may be assigned
                the same class name or names. Multiple class names must be separated by white space characters. "

  -- http://www.w3.org/TR/html4/struct/global.html#adef-class

but the CSS specs are pretty clear that identifiers can
contain excape gizmos:

"In CSS2, identifiers (including element names, classes, and IDs in selectors) 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".  "

 -- http://www.w3.org/TR/REC-CSS2/syndata.html#keywords

I don't see a relevant test in the test suite.
	http://www.w3.org/Style/CSS/Test/

Please add one.

perhaps in "Class as selector"
	http://www.w3.org/Style/CSS/Test/current/sec14.htm


Are there *any* implementations that get the identifier
parsing in CSS right? I tried Netscape 4 and IE 4
and Opera 4 and Amaya and they all failed.

I can see that the relevant Amaya code doesn't implement
the escape codes: the only occurrence of '\' in
the code is to handle strings.
http://dev.w3.org/cvsweb/Amaya/amaya/styleparser.c
 1.59 Tue Jun 27 11:19:46 2000 UTC

Ah... flute seems to grok.

http://dev.w3.org/cvsweb/java/classes/org/w3c/flute/parser/Parser.jj
1.12 Wed Apr 19 21:59:52 2000 UTC

-- 
Dan Connolly, W3C http://www.w3.org/People/Connolly/
Received on Wednesday, 19 July 2000 03:54:51 GMT

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