Skip to content

Commit 5c12594

Browse files
committed
Make adoption account for DocumentFragment nodes with hosts
Tests: ... Corresponding HTML PR: ... Closes #813 and closes #814.
1 parent 488eeab commit 5c12594

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

dom.bs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5236,10 +5236,15 @@ when invoked, must run these steps:
52365236
algorithm is passed <var>node</var> and <var>oldDocument</var>, as indicated in the <a>adopt</a>
52375237
algorithm.
52385238

5239-
<p>To <dfn export id=concept-node-adopt>adopt</dfn> a <var>node</var> into a <var>document</var>, run
5240-
these steps:
5239+
<p>To <dfn export id=concept-node-adopt>adopt</dfn> a <var>node</var> into a <var>document</var>,
5240+
with an optional <var>forceDocumentFragmentAdoption</var>, run these steps:
52415241

52425242
<ol>
5243+
<li>
5244+
<p>If <var>forceDocumentFragmentAdoption</var> is not given, then set it false.
5245+
5246+
<p class=note>This is needed for HTML's <{template}> element.
5247+
52435248
<li><p>Let <var>oldDocument</var> be <var>node</var>'s <a for=Node>node document</a>.
52445249

52455250
<li><p>If <var>node</var>'s <a for=tree>parent</a> is non-null, then <a for=/>remove</a>
@@ -5254,6 +5259,15 @@ these steps:
52545259
<a>shadow-including inclusive descendants</a>:
52555260

52565261
<ol>
5262+
<li>
5263+
<p>If <var>forceDocumentFragmentAdoption</var> is false, <var>inclusiveDescendant</var> is a
5264+
{{DocumentFragment}} <a for=/>node</a>, <var>inclusiveDescendant</var> is <var>node</var>, and
5265+
<var>node</var>'s <a for=DocumentFragment>host</a> is non-null, then
5266+
<a for=iteration>continue</a>.
5267+
5268+
<p class=note>This is only reasonable as long as all <a>adopt</a> callers remove the children
5269+
of <var>node</var>.
5270+
52575271
<li><p>Set <var>inclusiveDescendant</var>'s <a for=Node>node document</a> to <var>document</var>.
52585272

52595273
<li><p>If <var>inclusiveDescendant</var> is an <a for=/>element</a>, then set the
@@ -5283,6 +5297,12 @@ must run these steps:
52835297
<li><p>If <var>node</var> is a <a for=/>shadow root</a>, then <a>throw</a> a
52845298
"{{HierarchyRequestError!!exception}}" {{DOMException}}.
52855299

5300+
<li>
5301+
<p>If <var>node</var> is a {{DocumentFragment}} <a for=/>node</a> and its
5302+
<a for=DocumentFragment>host</a> is non-null, then return <var>node</var>.
5303+
5304+
<p class=note>Unfortunately this does not throw for web compatibility.
5305+
52865306
<li><p><a>Adopt</a> <var>node</var> into <a>this</a>.
52875307

52885308
<li><p>Return <var>node</var>.

0 commit comments

Comments
 (0)