- From: Kartikaya Gupta <lists.whatwg@stakface.com>
- Date: Thu, 09 Jul 2009 14:09:27 +0000
According to this section 9.4, any descendant text node of a style element should be outputted literally, rather than being escaped. However, this doesn't seem to match what Opera/Chrome/FF do. Test case: <html> <body> <style id="test"> </style> <script type="text/javascript"> var test = document.getElementById("test"); var c1 = document.createElement( 'c1' ); c1.appendChild( document.createTextNode( 'some>stuff' ) ); test.appendChild( c1 ); test.appendChild( document.createTextNode( 'more<stuff' ) ); var html = test.innerHTML; alert(html); </script> </body> </html> Opera and Chrome will alert "<c1>some>stuff</c1>more<stuff" (escaping the angle bracket inside the child element) and Firefox just outputs "more<stuff" (presumably a bug). I tried a couple of the other special elements (script and xmp) and they worked the same way. I think for compatibility the spec should say "If the parent of the current node is a" instead of "If one of the ancestors of current node is a" for the Text/CDATASection handling. Cheers, kats
Received on Thursday, 9 July 2009 07:09:27 UTC