From 57a18734f2b80f87463579dc09ee41f0359949bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philip=20J=C3=A4genstedt?=
Let document be a Document node whose type is "html".
If context's node document is
- in quirks mode, then set document's mode to "quirks".
Let fragment be a new DocumentFragment whose node
+ document is context's node document.
Otherwise, if context's node
- document is in limited-quirks mode, then set document's mode to "limited-quirks".
Let parser be a new HTML parser associated with + context's node document.
If allowDeclarativeShadowRoots is true, then set document's allow declarative shadow roots to - true.
Set parser's TODO target to target.
Create a new HTML parser, and associate it with document.
If allowDeclarativeShadowRoots is true, then set parser's + TODO to true.
Set the state of the HTML parser's tokenization stage as @@ -144577,16 +144571,18 @@ console.assert(container.firstChild instanceof SuperP); transitions.
Let root be the result of creating an
- element given document, "html", the HTML
- namespace, null, null, false, and context's custom element registry.
Set up the HTML parser's stack of open elements so that it + contains just the single node (not element!) fragment.
Append root to - document.
If context is a template
element, then push "in template" onto the
@@ -144625,7 +144621,7 @@ console.assert(container.firstChild instanceof SuperP);
Start the HTML parser and let it run until it has consumed all the characters just inserted into the input stream.
Return root's children, in tree
+ Return fragments's children, in tree
order.
Let newChildren be the result of the HTML fragment parsing - algorithm given contextElement, html, and true.
Let fragment be a new DocumentFragment whose node
- document is contextElement's node document.
For each node in newChildren, append node to fragment.
Remove all target's children, in tree order.
Replace all with fragment within - target.
Run the HTML fragment parsing algorithm given target, + contextElement, html, and true.
Let fragment be a new DocumentFragment whose node
+ document is context's node document.
Let algorithm be the HTML fragment parsing algorithm.
If context's node document is an XML document, then set algorithm to the XML fragment parsing algorithm.
Let newChildren be the result of invoking algorithm given - context and markup.
Let fragment be a new DocumentFragment whose node
- document is context's node document.
For each node of newChildren, in tree order: append node to fragment.
- -This ensures the node document for the new nodes is correct.
-Invoke algorithm given fragment, context and + markup.
Return fragment.
The HTML fragment parsing algorithm, given an Element node context, string input, and an
- optional boolean allowDeclarativeShadowRoots (default false) is the following steps.
- They return a list of zero or more nodes.
The HTML fragment parsing algorithm, given an Element or
+ DocumentFragment target, an Element context, a string input, and an
+ optional boolean allowDeclarativeShadowRoots (default false) is the following
+ steps. Zero or more nodes are inserted into target.
Parts marked fragment case in algorithms in the HTML parser section are parts that only occur if the parser was created for the purposes of this @@ -144522,9 +144509,6 @@ console.assert(container.firstChild instanceof SuperP); handling this algorithm, then that is an error in the specification.
Let fragment be a new DocumentFragment whose node
- document is context's node document.
Let parser be a new HTML parser associated with context's node document.
Set up the HTML parser's stack of open elements so that it - contains just the single node (not element!) fragment.
Return the resulting Document node's document element's children, in tree order.
Append the resulting Document
+ node's document element's children to
+ target, in tree order.