RESOLVED WONTFIX 60316
Implement document.innerHTML
https://bugs.webkit.org/show_bug.cgi?id=60316
Summary Implement document.innerHTML
Andy Estes
Reported 2011-05-05 16:57:24 PDT
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>.
Attachments
Patch (1.74 KB, patch)
2011-05-05 17:10 PDT, Andy Estes
no flags
Andy Estes
Comment 1 2011-05-05 17:10:05 PDT
Eric Seidel (no email)
Comment 2 2011-05-05 17:11:00 PDT
Comment on attachment 92505 [details] Patch OK. I would have said "if". I'm not sure we want to implement document.innerHTML.
Andy Estes
Comment 3 2011-05-05 17:11:19 PDT
(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.
Andy Estes
Comment 4 2011-05-05 17:12:52 PDT
Alexey Proskuryakov
Comment 5 2011-05-05 22:16:00 PDT
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?
Eric Seidel (no email)
Comment 6 2011-05-05 22:22:33 PDT
Sounds like a question for Hixie (probably in the w3c bug).
Alexey Proskuryakov
Comment 7 2011-05-05 22:41:54 PDT
Note that HTML5 doesn't specify DOMParser and XMLSerializer.
Ian 'Hixie' Hickson
Comment 8 2011-05-06 11:11:12 PDT
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
Alexey Proskuryakov
Comment 9 2011-06-18 12:15:04 PDT
Only a FIXME has been landed, and this bug is still unresolved.
Alexey Proskuryakov
Comment 10 2011-06-18 12:22:12 PDT
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.
Mathias Bynens
Comment 11 2012-02-08 06:46:29 PST
The spec has moved to http://html5.org/specs/dom-parsing.html#innerhtml, and sadly, `document.innerHTML` has been removed.
Eric Seidel (no email)
Comment 12 2012-02-08 08:46:09 PST
Yay! So you're saying we can remove this support from the parser. :) (Which should simplify things again.)
Alexey Proskuryakov
Comment 13 2012-05-17 10:34:55 PDT
What's the status of this bug now, given bug 84646?
Rafael Weinstein
Comment 14 2012-05-17 10:52:22 PDT
I'd say it's safe to close it. Document.parse() is now the consensus recommendation for contextless parsing.
Alexey Proskuryakov
Comment 15 2012-05-17 11:14:03 PDT
Let's close it then!
Rafael Weinstein
Comment 16 2012-05-17 11:33:21 PDT
Hazzah!
Note You need to log in before you can comment on or make changes to this bug.