This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 12031 - Please provide example of fragment parsing w/o a contextElement
Summary: Please provide example of fragment parsing w/o a contextElement
Alias: None
Product: HTML WG
Classification: Unclassified
Component: LC1 HTML5 spec (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
Depends on:
Reported: 2011-02-10 23:47 UTC by contributor
Modified: 2011-08-04 05:03 UTC (History)
10 users (show)

See Also:


Description contributor 2011-02-10 23:47:37 UTC

Please provide example of fragment parsing w/o a contextElement

Posted from:
Comment 1 Eric Seidel 2011-02-10 23:52:45 UTC
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*. 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).
Comment 2 Eric Seidel 2011-02-10 23:54:36 UTC 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.
Comment 3 Eric Seidel 2011-02-18 23:24:22 UTC
We're about to break support for context-less fragments further:
Comment 4 Ian 'Hixie' Hickson 2011-05-05 06:44:28 UTC
Setting document.innerHTML calls the algorithm without a context element.
Comment 5 Henri Sivonen 2011-05-05 07:01:39 UTC
(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.
Comment 6 Ian 'Hixie' Hickson 2011-05-13 03:30:47 UTC
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:

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.
Comment 7 Michael[tm] Smith 2011-08-04 05:03:24 UTC
mass-moved component to LC1