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

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 UTC