This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html Section: http://www.whatwg.org/specs/web-apps/current-work/#parsing-html-fragments Comment: Please provide example of fragment parsing w/o a contextElement Posted from: 173.164.128.210
WebKit has implemented fragment parsing for HTML5, supporting parsing both with and without a contextElement per the spec. However, every case which we initially did not use a context element was *wrong*. https://bugs.webkit.org/show_bug.cgi?id=44450 is one such example of where we initially didn't use a contextElement, and later had to add a fake <body> context element to make parsing correct. We have recently moved away from using a real dummy document for the fragment parsing. And in doing so broken the ability to parse fragments w/o a context element 100% correctly. Since there is currently no way in WebKit (or in the spec as far as I can tell?) to trigger parsing a fragment w/o a context element, this is OK. Since there is no way in WebKit (or the spec) is seems that the spec should either provide an example of parsing w/o a context element (when such would be used) or note that that case is impossible to provide implementors (like webkit) more freedom of implementation (by assuming that there will always be a context element, as is currently the case).
https://bugs.webkit.org/show_bug.cgi?id=48719 is where WebKit removed the ability to correctly parse fragments w/o a context element. It's possible we could fix support for context-less fragment parsing, however w/o justification from the spec it seems better to assume we'll never need it.
We're about to break support for context-less fragments further: https://bugs.webkit.org/show_bug.cgi?id=48719#c120
Setting document.innerHTML calls the algorithm without a context element.
(In reply to comment #4) > Setting document.innerHTML calls the algorithm without a context element. Implementors should note that document.innerHTML isn't descriptive of the Web but an prescriptive addition that just looks a lot like it might be part of the descriptive content of the spec. FWIW, when there's no context, Gecko uses body in the HTML namespace as the context. I'm assuming that this situation could arise with Range::createContextualFragment somehow, but I'm not sure how exactly.
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document: http://dev.w3.org/html5/decision-policy/decision-policy.html Status: Partially Accepted Change Description: see diff given below Rationale: I added a note mentioning the new Document.innerHTML API as an example of where there'd be no context node.
mass-moved component to LC1