W3C home > Mailing lists > Public > www-style@w3.org > February 2010

Re: [css2.1] Content of a string containing a backslash followed immediately by EOF

From: Zack Weinberg <zweinberg@mozilla.com>
Date: Tue, 16 Feb 2010 15:34:45 -0800
To: Zack Weinberg <zweinberg@mozilla.com>
Cc: www-style@w3.org
Message-ID: <20100216153445.17f1eb54@mozilla.com>
Zack Weinberg <zweinberg@mozilla.com> wrote:
> 
> End of style sheet closes a string without error, but if the last
> character before the EOF is a backslash, what should the contents of
> the string be?  For instance, consider
> 
> <!doctype html>
> <style>span::before { content: "\</style>
> <p>a<span>b</span>c</p>
> 
> Should anything appear in between the 'a' and the 'b'?  If so, what?

Following up to myself in order to think out loud.  I see three
possibilities for the above example.

1) The value of the string is "\\".
2) The value of the string is "", but the backslash is part of the
string token.
3) The value of the string is "" and the backslash in the source text
is not part of the string token.  It is processed as a separate DELIM
token.  

Either (1) or (3) is fine by me, but (2) seems less logical.  I
have put a more sophisticated test at
http://people.mozilla.org/~zweinberg/backslashes.html which tells me
that Opera appears to implement (2).  Read it as follows:

 - The first three lines are controls which should read

      a:'\'
      b:'\'
      c:'x\'

   If they don't, either the browser does not support this use of
   ::before, or it does not implement the CSS2.1 EOF rule for more
   "normal" cases.

 - Possibility 1:

      d:'\'
      e:'x\'

 - Possibility 2:

      d:''
      e:'x'

 - Possibility 3:

      d:''
      e:''

zw
Received on Tuesday, 16 February 2010 23:35:19 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:24 GMT