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

RE: [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 14:30:04 -0800
To: Zack Weinberg <zweinberg@mozilla.com>, W3C Emailing list for WWW Style <www-style@w3.org>, "info@gtalbot.org" <info@gtalbot.org>
Message-ID: <00BD06E707F60B4F9D6A3E75C712209D580CA0BE91@NA-EXMSG-C104.redmond.corp.microsoft.com>

I believe we treat this in the CSS 2.1 parser in IE 8 standards mode as an error, not as gre\00000Aen. The reason is this:

escape          {unicode}|\\[^\r\n\f0-9a-f]

The hat symbol in that matching group means NOT any of those characters. So you can't have a \ followed by a \n. This means we treat \ as an unknown token, then we treat the \n as some space then we continue with a second identifier on the following line. Specifically:

_aBcDeF\gHi\\nJkL\mNoPqR\sTuVwXyZ (please treat \n as if it were an actual newline)

CSSIdentifier - _aBcDeFgHi
Unknown - \
Space - \n
CSSIdentifier - JkLmNoPqRsTuVwXyZ

Justin

-----Original Message-----
From: www-style-request@w3.org [mailto:www-style-request@w3.org] On Behalf Of Zack Weinberg
Sent: Wednesday, November 05, 2008 1:10 PM
To: W3C Emailing list for WWW Style; info@gtalbot.org
Subject: Re: [CSS2.1] Clarification on section 4.1.3 and the application of escaped newlines to identifiers.

fantasai <fantasai.lists@inkedblade.net> wrote:
> Justin Rogers wrote:
> > 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.
>
> The newline is a special character. It normally ends an identifier.
> If it is escaped, then it forms part of the identifier. In this case,
> that example should parse equivalent to
>
> DIV { background-color: gre\00000Aen; }

Gecko will be easy to change, but I'm not seeing other browsers do what you say they ought to do.  The attached test case uses the construct

#iden\
tifier { background-color: lime; }

 -- Firefox 3 applies this rule to an element whose ID attribute is
    "identifier".
 -- IE 7 does the same.  I don't have convenient access to 6 or 8.
 -- Opera 9.52 treats this as a parse error.

zw
Received on Wednesday, 5 November 2008 22:33:59 GMT

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