W3C home > Mailing lists > Public > www-archive@w3.org > June 2007

RE: [whatwg] void elements vs. content model = "empty"

From: Ian Hickson <ian@hixie.ch>
Date: Tue, 19 Jun 2007 23:07:50 +0000 (UTC)
To: Kristof Zelechovski <giecrilj@stegny.2a.pl>
Cc: www-archive@w3.org
Message-ID: <Pine.LNX.4.64.0706192306260.10651@dhalsim.dreamhost.com>

On Wed, 20 Jun 2007, Kristof Zelechovski wrote:
>
> Well, thanks for the explanation.  The explanation lacks one point 
> though: such content will simply get dropped by innerHTML.  I do not 
> have an opinion whether it is right or wrong, I just wanted to say it 
> explicitly because it sounds odd.

Yes, the HTML version of innerHTML has a number of limitations. This is 
discussed in the spec:

# 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>".

Actually I should update that to mention that it can happen with 
conformant content as well.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 19 June 2007 23:08:00 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:33:10 UTC