@@ -5236,10 +5236,15 @@ when invoked, must run these steps:
5236
5236
algorithm is passed <var> node</var> and <var> oldDocument</var> , as indicated in the <a>adopt</a>
5237
5237
algorithm.
5238
5238
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:
5241
5241
5242
5242
<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
+
5243
5248
<li><p> Let <var> oldDocument</var> be <var> node</var> 's <a for=Node>node document</a> .
5244
5249
5245
5250
<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:
5254
5259
<a>shadow-including inclusive descendants</a> :
5255
5260
5256
5261
<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
+
5257
5271
<li><p> Set <var> inclusiveDescendant</var> 's <a for=Node>node document</a> to <var> document</var> .
5258
5272
5259
5273
<li><p> If <var> inclusiveDescendant</var> is an <a for=/>element</a> , then set the
@@ -5283,6 +5297,12 @@ must run these steps:
5283
5297
<li><p> If <var> node</var> is a <a for=/>shadow root</a> , then <a>throw</a> a
5284
5298
"{{HierarchyRequestError!!exception}} " {{DOMException}} .
5285
5299
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
+
5286
5306
<li><p> <a>Adopt</a> <var> node</var> into <a>this</a> .
5287
5307
5288
5308
<li><p> Return <var> node</var> .
0 commit comments