@@ -5265,10 +5265,15 @@ when invoked, must run these steps:
5265
5265
algorithm is passed <var> node</var> and <var> oldDocument</var> , as indicated in the <a>adopt</a>
5266
5266
algorithm.
5267
5267
5268
- <p> To <dfn export id=concept-node-adopt>adopt</dfn> a <var> node</var> into a <var> document</var> , run
5269
- these steps:
5268
+ <p> To <dfn export id=concept-node-adopt>adopt</dfn> a <var> node</var> into a <var> document</var> ,
5269
+ with an optional <var> forceDocumentFragmentAdoption </var> , run these steps:
5270
5270
5271
5271
<ol>
5272
+ <li>
5273
+ <p> If <var> forceDocumentFragmentAdoption</var> is not given, then set it false.
5274
+
5275
+ <p class=note> This is needed for HTML's <{template}> element.
5276
+
5272
5277
<li><p> Let <var> oldDocument</var> be <var> node</var> 's <a for=Node>node document</a> .
5273
5278
5274
5279
<li><p> If <var> node</var> 's <a for=tree>parent</a> is non-null, then <a for=/>remove</a>
@@ -5283,6 +5288,15 @@ these steps:
5283
5288
<a>shadow-including inclusive descendants</a> :
5284
5289
5285
5290
<ol>
5291
+ <li>
5292
+ <p> If <var> forceDocumentFragmentAdoption</var> is false, <var> inclusiveDescendant</var> is a
5293
+ {{DocumentFragment}} <a for=/>node</a> , <var> inclusiveDescendant</var> is <var> node</var> , and
5294
+ <var> node</var> 's <a for=DocumentFragment>host</a> is non-null, then
5295
+ <a for=iteration>continue</a> .
5296
+
5297
+ <p class=note> This is only reasonable as long as all <a>adopt</a> callers remove the children
5298
+ of <var> node</var> .
5299
+
5286
5300
<li><p> Set <var> inclusiveDescendant</var> 's <a for=Node>node document</a> to <var> document</var> .
5287
5301
5288
5302
<li><p> If <var> inclusiveDescendant</var> is an <a for=/>element</a> , then set the
@@ -5312,6 +5326,12 @@ must run these steps:
5312
5326
<li><p> If <var> node</var> is a <a for=/>shadow root</a> , then <a>throw</a> a
5313
5327
"{{HierarchyRequestError!!exception}} " {{DOMException}} .
5314
5328
5329
+ <li>
5330
+ <p> If <var> node</var> is a {{DocumentFragment}} <a for=/>node</a> and its
5331
+ <a for=DocumentFragment>host</a> is non-null, then return <var> node</var> .
5332
+
5333
+ <p class=note> Unfortunately this does not throw for web compatibility.
5334
+
5315
5335
<li><p> <a>Adopt</a> <var> node</var> into <a>this</a> .
5316
5336
5317
5337
<li><p> Return <var> node</var> .
0 commit comments