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: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 05 Nov 2008 20:42:29 -0500
Message-ID: <49124B85.2060401@mit.edu>
To: fantasai <fantasai.lists@inkedblade.net>
CC: W3C Emailing list for WWW Style <www-style@w3.org>, info@gtalbot.org

fantasai.lists@inkedblade.net wrote:
> The newline is a special character. It normally ends an identifier.
> If it is escaped, then it forms part of the identifier.

I don't think this is actually the case as the spec stands...  Here are 
the relevant parts of CSS2.1 section 4.1.1 (all the parts that mention \\):

   unicode  \\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?
   escape   {unicode}|\\[^\n\r\f0-9a-f]
   string1  \"([^\n\r\f\\"]|\\{nl}|{escape})*\"
   string2  \'([^\n\r\f\\']|\\{nl}|{escape})*\'

So backslash followed by a newline doesn't actually match any of these 
productions.  In particular it most certainly doesn't match the 'escape' 
production, which it would need to do for the above to be true.

So as far as I can tell, a character stream in which newline follows 
backslash cannot be tokenized as a stylesheet at all, with the usual 
"behavior is undefined" thing that seems to trigger.

I do agree that having \\\n be treated as \00000A would make more sense, 
and if we awnt that we probably need to allow \\{nl} in nmchar and 
nmstart explicitly.

-Boris
Received on Thursday, 6 November 2008 01:43:25 GMT

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