Re: [CSS21] Escaping characters (comment, editorial)

timeless, Sun, 3 Apr 2011 15:51:22 +0300:
> On Sun, Feb 20, 2011 at 7:14 PM, Leif Halvard Silli wrote:
>>  For the sentence:
>>    "First, inside a string, a backslash followed by a newline is
>>     ignored (i.e., the string is deemed not to contain either the
>>     backslash or the newline)."
>>  Insert the wording "backslash newline escape" etc:
>>    "First, inside a string, a plain backslash newline escape (backslash
>>     followed by newline) cancels the meaning of the newline so that
>>     the string is deemed to not contain whether backslash or newline."
> 
> it should be "demeed to contain neither backslash nor newline". You
> have 'whether' which i think is a typo for 'either'.

It was meant to be correct. But the "or" should probably be "nor":
    "is deemed to not contain whether backslash nor newline."
It is meant to match sentences such as this one: "we do not know 
whether it will cost nor how much", see 
http://www.pcreview.co.uk/forums/no-we-do-not-know-whether-cost-nor-much-after-release-t1698715.html


But here is a minimum change (for that part of the sentence) - simply 
delete the confusing word "either" and replace "or" with "nor":
    "deemed not to contain the backslash nor the newline."
Best?

>>  For the sentence:
>>    "Second, it cancels the meaning of special CSS characters."
>>  Replace "it cancels" with "using plain backslash escapes to cancel":
>>    "Second, using plain backslash escapes to cancel the meaning of
>> special
>>     CSS characters."
>> 
>>  Add note about what "special CSS characters" means:
>>    "Special characters include all characters that have syntactic
>>     meaning in CSS: quotes, combinators, characters that have special
>>     meaning inside CSS indentifiers and characters that cannot appear
>>     unescaped inside CSS identifiers."
>>     [Are there other special characters?]
> 
> I believe the null character may count (\0).

I suppose you meant U+0000, which can be escaped as \0 or \000000. I 
don't know if \0 is a special character. Can it be said to have 
"special meaning in CSS"? Does it behave differently when it is not 
escaped? Let us apply the some criteria:
 1) Is it "special"? Answer: CSS 2.1 says that it is undefined what 
happens if a style sheet does contain that character. So this is kind 
of "special" ... Perhaps it fits. But I don't think so.
 2) Does it behave different when escaped compared to unescaped?  sure that it is possible to type - not 
every editor allows it, anyway.
 3) Thus: Can the \0 be typed without escaping it? It probably fits 
this bill- But whether it is type-able/paste-able probably isn't a 
fundamental criteria, as what is possible/permitted differs.
4) OTOH, CSS 2.1 says that an escape "stand for the ISO 10646 
([ISO10646]) character with that number, which must not be zero". Does 
this mean that \0 is illegal? Despite the "must not", the CSS validator 
does not react if you try to validate for example this:
  \0{color:red}

Conclusions:
 If it is illegal, then that is a reason to not mention it.
 But if \0 is "special", then it is any more special than e.g. U+0001, 
fore example? That is: is there is a reason to call it out? Why mention 
U+000000 anymore than U+00001?

Speaking about what \0 can be used for, then it can only be used to 
trick certain user agents to see/not see certain style selectors. For 
example body\0{color:red} selects <body> in Opera and I think IE. In 
Firefox then body.\0{color:red}  will match <body class="0"> (thus it 
misinterprets the escape). 

>>  Add, at the end of the the paragraph which begins "Second, it
>> cancels",
>>  the following note:
>>    "Note that even hexadecimal backslash escapes (see next paragraph)
>>     cancel the meaning of special CSS characters."
>> 
>>  Add, att the end of the paragraph which begins "Third, backslash
>> escapes
>>  allow authors to refer to characters they cannot easily put in a
>>  document", the following note:
>>    "Note that even plain backslash escapes can sometimes be used to
>>     escape charactars which the document somehow prevents from being
> 
> characters

Yep.

>>     typed directly. In the following example from inside a 'style'
>>     element in a HTML document, the "/" is escaped to prevent the
>>     'style' element from being prematurely ended:
>>       <style type="text/css">
>>         div::before { content: "<style><\/style>"; }
>>       </style>

Let me also note a typo at the bottom of my original letter: [1]

I wrote:
  "THus: -{/*unpermitted*/} But \-{/*unpermitted*/}."
I meant:
  "THus: -{/*unpermitted*/} But \-{/*permitted*/}."

[1] 
http://www.w3.org/mid/20110220181440105351.85b7191c@xn--mlform-iua.no

-- 
Leif Halvard Silli

Received on Sunday, 3 April 2011 18:19:05 UTC