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

[CSS2.1] Clarification on section 4.1.3 and the application of escaped newlines to identifiers.

From: Justin Rogers <justrog@microsoft.com>
Date: Wed, 5 Nov 2008 10:30:13 -0800
To: "www-style@w3.org" <www-style@w3.org>, "info@gtalbot.org" <info@gtalbot.org>
Message-ID: <00BD06E707F60B4F9D6A3E75C712209D580CA0BC48@NA-EXMSG-C104.redmond.corp.microsoft.com>
G Talbot has a test case that implies the following CSS identifier be reconstituted by throwing out the escaped newline.

DIV
{
background-color: gre\
en;
}

However, there is nothing in the wording of the specification that implies this is true, though other browsers are clearly accepting this. Below the spec  says 1) inside of a string, which we are not. 2) cancels the meaning of special characters, which it is not, 3) allows for inserting Unicode characters, which it again is not.

There is a note that only FireFox currently supports this behavior, which I believe makes them non-compliant. My testing with Opera/Safari/IE shows that we all throw this out which is what I would expect. It would be nice to get the bug he opened against the CSS validator deleted or closed as By Design and perhaps update the test case so that it marks the appropriate compliant/non-compliant browsers as of current date.

Relevant test case:
http://gtalbot.org/BrowserBugsSection/MSIE8Bugs/escape-newline-with-backslash-inside-string.html

Relevant spec piece:
In CSS 2.1, a backslash (\) character indicates three types of character escapes.

First, inside a string<http://www.w3.org/TR/CSS21/syndata.html#strings>, a backslash followed by a newline is ignored (i.e., the string is deemed not to contain either the backslash or the newline).

Second, it cancels the meaning of special CSS characters. Any character (except a hexadecimal digit) can be escaped with a backslash to remove its special meaning. For example, "\"" is a string consisting of one double quote. Style sheet preprocessors must not remove these backslashes from a style sheet since that would change the style sheet's meaning.

Third, backslash escapes allow authors to refer to characters they can't easily put in a document. In this case, the backslash is followed by at most six hexadecimal digits (0..9A..F), which stand for the ISO 10646 ([ISO10646]<http://www.w3.org/TR/CSS21/refs.html#ref-ISO10646>) character with that number, which must not be zero. (It is undefined in CSS 2.1 what happens if a style sheet does contain a character with Unicode codepoint zero.) If a character in the range [0-9a-f] follows the hexadecimal number, the end of the number needs to be made clear. There are two ways to do that:
Relevant bug against the CSS validator:
http://www.w3.org/Bugs/Public/show_bug.cgi?id=6203

Justin Rogers [MSFT]
Received on Wednesday, 5 November 2008 18:32:49 GMT

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