@@ -4854,6 +4854,10 @@ and an optional <a for=/>document</a> <dfn export for="clone a node"><var>docume
48544854 <li><p> Let <var> shadowRootRegistry</var> be <var> node</var> 's <a for=Element>shadow root</a>' s
48554855 <a for=ShadowRoot>custom element registry</a> .
48564856
4857+ <li><p> If <var> shadowRootRegistry</var> <a>is a global custom element registry</a> , then set
4858+ <var> shadowRootRegistry</var> to <var> document</var> 's
4859+ <a>effective global custom element registry</a> .
4860+
48574861 <li><p> <a>Attach a shadow root</a> with <var> copy</var> , <var> node</var> 's
48584862 <a for=Element>shadow root</a> 's <a for=ShadowRoot>mode</a>, true, <var>node</var>' s
48594863 <a for=Element>shadow root</a> 's <a for=ShadowRoot>serializable</a>, <var>node</var>' s
@@ -4896,6 +4900,9 @@ and an optional <a for=/>document</a> <dfn export for="clone a node"><var>docume
48964900 <li><p> If <var> registry</var> is null, then set <var> registry</var> to
48974901 <var> fallbackRegistry</var> .
48984902
4903+ <li><p> If <var> registry</var> <a>is a global custom element registry</a> , then set
4904+ <var> registry</var> to <var> document</var> 's <a>effective global custom element registry</a> .
4905+
48994906 <li><p> Set <var> copy</var> to the result of <a>creating an element</a> , given
49004907 <var> document</var> , <var> node</var> 's <a for=Element>local name</a>, <var>node</var>' s
49014908 <a for=Element>namespace</a> , <var> node</var> 's <a for=Element>namespace prefix</a> ,
@@ -4920,10 +4927,18 @@ and an optional <a for=/>document</a> <dfn export for="clone a node"><var>docume
49204927
49214928 <dl class=switch>
49224929 <dt> {{Document}}
4923- <dd><p> Set <var> copy</var> 's <a for=Document>encoding</a> , <a for=Document>content type</a> ,
4924- <a for=Document>URL</a> , <a for=Document>origin</a> , <a for=Document>type</a> ,
4925- <a for=Document>mode</a> , <a for=Document>allow declarative shadow roots</a> , and
4926- <a for=Document>custom element registry</a> to those of <var> node</var> .
4930+ <dd>
4931+ <ol>
4932+ <li><p> Set <var> copy</var> 's <a for=Document>encoding</a> , <a for=Document>content type</a> ,
4933+ <a for=Document>URL</a> , <a for=Document>origin</a> , <a for=Document>type</a> ,
4934+ <a for=Document>mode</a> , and <a for=Document>allow declarative shadow roots</a> , to those of
4935+ <var> node</var> .
4936+
4937+ <li><p> If <var> node</var> 's <a for=Document>custom element registry</a>' s
4938+ <a for=CustomElementRegistry>is scoped</a> is true, then set <var> copy</var> 's
4939+ <a for=Document>custom element registry</a> to <var> node</var> 's
4940+ <a for=Document>custom element registry</a> .
4941+ </ol>
49274942
49284943 <dt> {{DocumentType}}
49294944 <dd><p> Set <var> copy</var> 's <a for=DocumentType>name</a> , <a>public ID</a> , and
@@ -5774,6 +5789,7 @@ method steps are to return the <a>list of elements with class names <var>classNa
57745789<p class=note> The HTML Standard will, e.g., define that for <code> html</code> and the
57755790<a>HTML namespace</a> , the {{HTMLHtmlElement}} interface is used. [[!HTML]]
57765791
5792+ <div algorithm>
57775793<p> The
57785794<dfn method for=Document><code>createElement(<var>localName</var>, <var>options</var>)</code></dfn>
57795795method steps are:
@@ -5795,7 +5811,9 @@ method steps are:
57955811 <li><p> Return the result of <a>creating an element</a> given <a>this</a> , <var> localName</var> ,
57965812 <var> namespace</var> , null, <var> is</var> , true, and <var> registry</var> .
57975813</ol>
5814+ </div>
57985815
5816+ <div algorithm>
57995817<p> The <dfn noexport>internal <code>createElementNS</code> steps</dfn> , given <var> document</var> ,
58005818<var> namespace</var> , <var> qualifiedName</var> , and <var> options</var> , are as follows:
58015819
@@ -5811,13 +5829,17 @@ method steps are:
58115829 <var> localName</var> , <var> namespace</var> , <var> prefix</var> , <var> is</var> , true, and
58125830 <var> registry</var> .
58135831</ol>
5832+ </div>
58145833
5834+ <div algorithm>
58155835<p> The
58165836<dfn method for=Document><code>createElementNS(<var>namespace</var>, <var>qualifiedName</var>, <var>options</var>)</code></dfn>
58175837method steps are to return the result of running the
58185838<a>internal <code>createElementNS</code> steps</a> , given <a>this</a> , <var> namespace</var> ,
58195839<var> qualifiedName</var> , and <var> options</var> .
5840+ </div>
58205841
5842+ <div algorithm>
58215843<p> To <dfn>flatten element creation options</dfn> , given a string or {{ElementCreationOptions}}
58225844dictionary <var> options</var> and a <a for=/>document</a> <var> document</var> :
58235845
@@ -5833,6 +5855,10 @@ dictionary <var>options</var> and a <a for=/>document</a> <var>document</var>:
58335855 <li><p> If <var> options</var> ["{{ElementCreationOptions/customElementRegistry}}"]
58345856 <a for=map>exists</a> , then set <var> registry</var> to it.
58355857
5858+ <li><p> If <var> registry</var> 's <a for=CustomElementRegistry>is scoped</a> is false and
5859+ <var> registry</var> is not <var> document</var> 's <a for=Document>custom element registry</a> ,
5860+ then <a>throw</a> a "{{NotSupportedError!!exception}} " {{DOMException}} .
5861+
58365862 <li><p> If <var> options</var> ["{{ElementCreationOptions/is}}"] <a for=map>exists</a> , then set
58375863 <var> is</var> to it.
58385864
@@ -5848,6 +5874,7 @@ dictionary <var>options</var> and a <a for=/>document</a> <var>document</var>:
58485874
58495875<p class=note> {{Document/createElement()}} and {{Document/createElementNS()}} 's <var> options</var>
58505876parameter is allowed to be a string for web compatibility.
5877+ </div>
58515878
58525879<p> The <dfn method for=Document><code>createDocumentFragment()</code></dfn> method steps are to
58535880return a new {{DocumentFragment}} <a for=/>node</a> whose <a for=Node>node document</a> is
@@ -5944,6 +5971,10 @@ method steps are:
59445971
59455972 <li><p> If <var> options</var> ["{{ImportNodeOptions/customElementRegistry}}"]
59465973 <a for=map>exists</a> , then set <var> registry</var> to it.
5974+
5975+ <li><p> If <var> registry</var> 's <a for=CustomElementRegistry>is scoped</a> is false and
5976+ <var> registry</var> is not <a>this</a> 's <a for=Document>custom element registry</a> , then
5977+ <a>throw</a> a "{{NotSupportedError!!exception}} " {{DOMException}} .
59475978 </ol>
59485979
59495980 <li><p> If <var> registry</var> is null, then set <var> registry</var> to the result of
@@ -5956,11 +5987,14 @@ method steps are:
59565987</ol>
59575988</div>
59585989
5990+ <div algorithm>
59595991<p> <a lt="Other applicable specifications">Specifications</a> may define
59605992<dfn export id=concept-node-adopt-ext>adopting steps</dfn> for all or some <a for=/>nodes</a> . The
5961- algorithm is passed <var> node</var> and <var> oldDocument</var> , as indicated in the <a>adopt</a>
5962- algorithm.
5993+ algorithm is passed <var ignore> node</var> and <var ignore> oldDocument</var> , as indicated in the
5994+ <a>adopt</a> algorithm.
5995+ </div>
59635996
5997+ <div algorithm>
59645998<p> To <dfn export id=concept-node-adopt>adopt</dfn> a <var> node</var> into a <var> document</var> , run
59655999these steps:
59666000
@@ -5981,9 +6015,24 @@ these steps:
59816015 <ol>
59826016 <li><p> Set <var> inclusiveDescendant</var> 's <a for=Node>node document</a> to <var> document</var> .
59836017
5984- <li><p> If <var> inclusiveDescendant</var> is an <a for=/>element</a> , then set the
5985- <a for=Node>node document</a> of each <a>attribute</a> in <var> inclusiveDescendant</var> 's
5986- <a for=Element>attribute list</a> to <var> document</var> .
6018+ <li><p> If <var> inclusiveDescendant</var> is a <a for=/>shadow root</a> and
6019+ <var> inclusiveDescendant</var> 's <a for=ShadowRoot>custom element registry</a>
6020+ <a>is a global custom element registry</a> , then set <var> inclusiveDescendant</var> 's
6021+ <a for=ShadowRoot>custom element registry</a> to <var> document</var> 's
6022+ <a>effective global custom element registry</a> .
6023+
6024+ <li>
6025+ <p> Otherwise, if <var> inclusiveDescendant</var> is an <a for=/>element</a> :
6026+
6027+ <ol>
6028+ <li><p> Set the <a for=Node>node document</a> of each <a>attribute</a> in
6029+ <var> inclusiveDescendant</var> 's <a for=Element>attribute list</a> to <var> document</var> .
6030+
6031+ <li><p> If <var> inclusiveDescendant</var> 's <a for=Element>custom element registry</a>
6032+ <a>is a global custom element registry</a> , then set <var> inclusiveDescendant</var> 's
6033+ <a for=Element>custom element registry</a> to <var> document</var> 's
6034+ <a>effective global custom element registry</a> .
6035+ </ol>
59876036 </ol>
59886037
59896038 <li><p> For each <var> inclusiveDescendant</var> in <var> node</var> 's
@@ -5997,7 +6046,9 @@ these steps:
59976046 <a>adopting steps</a> with <var> inclusiveDescendant</var> and <var> oldDocument</var> .
59986047 </ol>
59996048</ol>
6049+ </div>
60006050
6051+ <div algorithm>
60016052<p> The <dfn method for=Document><code>adoptNode(<var>node</var>)</code></dfn> method steps are:
60026053
60036054<ol>
@@ -6014,6 +6065,24 @@ these steps:
60146065
60156066 <li><p> Return <var> node</var> .
60166067</ol>
6068+ </div>
6069+
6070+ <hr>
6071+
6072+ <p> Null or a {{CustomElementRegistry}} object <var> registry</var>
6073+ <dfn>is a global custom element registry</dfn> if <var> registry</var> is non-null and
6074+ <var> registry</var> 's <a for=CustomElementRegistry>is scoped</a> is false.</p>
6075+
6076+ <p> A <a for=/>document</a> <var> document</var> 's <dfn>effective global custom element registry</dfn>
6077+ is:
6078+
6079+ <ol>
6080+ <li><p> If <var> document</var> 's <a for=Document>custom element registry</a>
6081+ <a>is a global custom element registry</a> , then return <var> document</var> 's
6082+ <a for=Document>custom element registry</a> .
6083+
6084+ <li><p> Return null.
6085+ </ol>
60176086
60186087<hr>
60196088
@@ -7515,8 +7584,17 @@ are:
75157584<ol>
75167585 <li><p> Let <var> registry</var> be <a>this</a> 's <a for=Element>custom element registry</a> .
75177586
7518- <li><p> If <var> init</var> ["{{ShadowRootInit/customElementRegistry}}"] is non-null, then set
7519- <var> registry</var> to it.
7587+ <li>
7588+ <p> If <var> init</var> ["{{ShadowRootInit/customElementRegistry}}"] is non-null:
7589+
7590+ <ol>
7591+ <li><p> Set <var> registry</var> to <var> init</var> ["{{ShadowRootInit/customElementRegistry}}"] .
7592+
7593+ <li><p> If <var> registry</var> 's <a for=CustomElementRegistry>is scoped</a> is false and
7594+ <var> registry</var> is not <a>this</a> 's <a>node document</a>' s
7595+ <a for=Document>custom element registry</a> , then <a>throw</a> a
7596+ "{{NotSupportedError!!exception}} " {{DOMException}} .
7597+ </ol>
75207598
75217599 <li><p> Run <a>attach a shadow root</a> with <a>this</a> ,
75227600 <var> init</var> ["{{ShadowRootInit/mode}}"] , <var> init</var> ["{{ShadowRootInit/clonable}}"] ,
0 commit comments