- From: Ian Hickson <ian@hixie.ch>
- Date: Wed, 6 Jun 2007 06:11:05 +0000 (UTC)
On Mon, 30 Jan 2006, Simon Pieters wrote: > > What should happen with comments that contain "-->" when you serialize > the DOM into HTML? When serializing into XML it should result in a fatal > error according to DOM3Core[1], but I guess that is not really desired > for HTML. Should the comment be dropped? Should the serializer insert a > space in between ("- ->")? The spec says: # If the element's contents are not conformant, it is possible that # the roundtripping through innerHTML will not work. For instance, if # the element is a textarea element to which a Comment node has been # appended, then assigning innerHTML to itself will result in the # comment being displayed in the text field. Similarly, if, as a # result of DOM manipulation, the element contains a comment that # contains the literal string "-->", then when the result of # serialising the element is parsed, the comment will be truncated at # that point and the rest of the comment will be interpreted as # markup. Another example would be making a script element contain a # text node with the text string "</script>". It currently says this for innerHTML. Should I say it in other places too? Or would something else be better? -- Ian Hickson U+1047E )\._.,--....,'``. fL http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 5 June 2007 23:11:05 UTC