Re: Serializing: Descendants of (R)CDATA elements

On Tue, 18 Mar 2008, Simon Pieters wrote:
> The serializing of HTML fragments algorithm currently looks up the 
> ancestor chain for Text and CDATASection nodes for CDATA elements (or 
> <plaintext>) in order to decide when to escape text.
> Firefox takes a different approach, it seems: when finding an (R)CDATA 
> element (or <plaintext>), emit the data of the child Text and 
> CDATASection nodes (escaped or not as appropriate) instead of recursing 
> the algorithm on its subtree.
> I think Firefox's approach is a bit more performant (it would probably 
> be less checking in the general case), and it roundtrips a bit better; 
> as the spec notes:
>    For instance, if a textarea element to which a Comment node has been
>    appended is serialised and the output is then reparsed, the comment
>    will end up being displayed in the text field.

Including the comment is what IE does.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Friday, 23 May 2008 00:21:11 UTC