Re: DOM comments inside a <style> element

On 12/27/10 6:04 AM, Daniel Glazman wrote:
> Le 27/12/10 12:40, Boris Zbarsky a écrit :
>
>> Consistency with what?
>
> Parsing of serialization of the tree should give the same result.

That's just not possible when DOM manipulation is involved.  It's 
possible to produce DOM's that can't be serialized in a form that 
round-trips to the same DO.  One can produce XML comments with embedded 
"--", one can produce HTML comments with embedded "-->", etc, etc.

>> Right now, the behavior is purely based on the DOM: the textContent of
>> the <style> element is passed to the CSS parser. At least apparently in
>> non-Webkit browsers.
>>
>> It sounds like you're proposing some other algorithm for determining the
>> data to pass to the CSS parser. What algorithm?
>
> Data passed to the CSS parser consists of the concatenation of
> children's textContent for text node and cdata sections and
> "<!--"+data+"-->" for comments.

Hmm.  That does appear to be what webkit does for XML, at least for 
comments...  I still don't see why that's desirable, since in XML 
comments really shouldn't affect behavior (and in particular, an XML 
parser is not guaranteed to preserve comment contents, according to 
XHTML 1.0 section C.4).

-Boris

Received on Monday, 27 December 2010 19:15:45 UTC