HTML5 includes an innerHTML attribute in the HTMLDocument interface definition, which should basically behave like the innerHTML on Element. See <http://www.whatwg.org/specs/web-apps/current-work/multipage/apis-in-html-documents.html#dom-innerhtml> for details. The most interesting difference between Document's innerHTML and Element's innerHTML is that the Document case is the only time when parsing a fragment should have no context element. This is important since we have implemented several optimizations to fragment parsing that assume there is always a context element, but there won't be in this case. In a W3C bug discussing context-less fragments, it was mentioned that document.innerHTML is prescriptive, rather than descriptive of existing web content. See <http://www.w3.org/Bugs/Public/show_bug.cgi?id=12031>.
Created attachment 92505 [details] Patch
Comment on attachment 92505 [details] Patch OK. I would have said "if". I'm not sure we want to implement document.innerHTML.
(In reply to comment #2) > (From update of attachment 92505 [details]) > OK. I would have said "if". I'm not sure we want to implement document.innerHTML. Sure, I'll change that.
Committed r85903: <http://trac.webkit.org/changeset/85903>
A read-only document.innerHTML would be a handy shortcut for (new XMLSerializer).serializeToString(document). What's the difference between parsing for document.innerHTML setter and DOMParser.parseFromString()? Do we really want them to be different?
Sounds like a question for Hixie (probably in the w3c bug).
Note that HTML5 doesn't specify DOMParser and XMLSerializer.
It's just a convenience accessor so you can replace the contents of an existing document more easily. DOMParser and company are being specced here, FWIW: http://html5.org/specs/dom-parsing.html
Only a FIXME has been landed, and this bug is still unresolved.
The reason why I'm asking about DOMParser here is that it works without triggering this assertion. If document.innerHTML is going to trigger it, then maybe its specification is incorrect.
The spec has moved to http://html5.org/specs/dom-parsing.html#innerhtml, and sadly, `document.innerHTML` has been removed.
Yay! So you're saying we can remove this support from the parser. :) (Which should simplify things again.)
What's the status of this bug now, given bug 84646?
I'd say it's safe to close it. Document.parse() is now the consensus recommendation for contextless parsing.
Let's close it then!
Hazzah!