@@ -4465,15 +4465,36 @@ dom-Range-extractContents, dom-Range-cloneContents -->
4465
4465
<var> copy</var> , if <var> copy</var> is a <a>document</a> , and set <var> copy</var> 's
4466
4466
<a for=Node>node document</a> to <var> document</var> otherwise.
4467
4467
4468
- <li> Run any <a>cloning steps</a> defined for <var> node</var> in
4468
+ <li><p> Run any <a>cloning steps</a> defined for <var> node</var> in
4469
4469
<a>other applicable specifications</a> and pass <var> copy</var> , <var> node</var> ,
4470
- <var> document</var> and the <i> clone children flag</i> if set, as parameters.
4470
+ <var> document</var> , and the <i> clone children flag</i> if set, as parameters.
4471
4471
4472
- <li> If the <i> clone children flag</i> is set, <a lt="clone a node">clone</a> all the
4473
- <a for=tree>children</a> of <var> node</var> and append them to <var> copy</var> , with
4474
- <var> document</var> as specified and the <i> clone children flag</i> being set.
4472
+ <li><p> If the <i> clone children flag</i> is set, then for each <a for=tree>child</a>
4473
+ <var> child</var> of <var> node</var> , in <a>tree order</a> : <a>append</a> the result of
4474
+ <a lt="clone a node">cloning</a> <var> child</var> with <var> document</var> and the
4475
+ <i> clone children flag</i> set, to <var> copy</var> .
4475
4476
4476
- <li> Return <var> copy</var> .
4477
+ <li>
4478
+ <p> If <var> node</var> is a <a for=Element>shadow host</a> whose <a for=/>shadow root</a> 's
4479
+ <a for=ShadowRoot>clonable</a> is true:
4480
+
4481
+ <ol>
4482
+ <li><p> Run <a>attach a shadow root</a> with <var> copy</var> , <var> node</var> 's
4483
+ <a for=Element>shadow root</a> 's <a for=ShadowRoot>mode</a>, true, <var>node</var>' s
4484
+ <a for=Element>shadow root</a> 's <a for=ShadowRoot>delegates focus</a>, and <var>node</var>' s
4485
+ <a for=Element>shadow root</a> 's <a for=ShadowRoot>slot assignment</a> .
4486
+
4487
+ <li><p> Set <var> copy</var> 's <a for=Element>shadow root</a>' s <a for=ShadowRoot>declarative</a>
4488
+ to <var> node</var> 's <a for=Element>shadow root</a>' s <a for=ShadowRoot>declarative</a> .
4489
+
4490
+ <li><p> If the <i> clone children flag</i> is set, then for each <a for=tree>child</a>
4491
+ <var> child</var> of <var> node</var> 's <a for=Element>shadow root</a> , in <a>tree order</a> :
4492
+ <a>append</a> the result of <a lt="clone a node">cloning</a> <var> child</var> with
4493
+ <var> document</var> and the <i> clone children flag</i> set, to <var> copy</var> 's
4494
+ <a for=Element>shadow root</a> .
4495
+ </ol>
4496
+
4497
+ <li><p> Return <var> copy</var> .
4477
4498
</ol>
4478
4499
4479
4500
<p> The <dfn method for=Node><code>cloneNode(<var>deep</var>)</code></dfn> method steps are:
@@ -4973,8 +4994,9 @@ known as <dfn export id=concept-document lt="document">documents</dfn>.
4973
4994
<dfn export for=Document id=concept-document-content-type>content type</dfn> (a string),
4974
4995
<dfn export for=Document id=concept-document-url>URL</dfn> (a <a for=/>URL</a> ),
4975
4996
<dfn export for=Document id=concept-document-origin>origin</dfn> (an <a for=/>origin</a> ),
4976
- <dfn export for=Document id=concept-document-type>type</dfn> ("<code> xml</code> " or "<code> html</code> "), and
4977
- <dfn export for=Document id=concept-document-mode>mode</dfn> ("<code> no-quirks</code> ", "<code> quirks</code> ", or "<code> limited-quirks</code> ").
4997
+ <dfn export for=Document id=concept-document-type>type</dfn> ("<code> xml</code> " or "<code> html</code> "),
4998
+ <dfn export for=Document id=concept-document-mode>mode</dfn> ("<code> no-quirks</code> ", "<code> quirks</code> ", or "<code> limited-quirks</code> "), and
4999
+ <dfn export for=Document>allow declarative shadow roots</dfn> (a boolean).
4978
5000
[[!ENCODING]]
4979
5001
[[!URL]]
4980
5002
[[!HTML]]
@@ -4983,8 +5005,8 @@ known as <dfn export id=concept-document lt="document">documents</dfn>.
4983
5005
<a for=/>encoding</a> , <a for=Document>content type</a> is
4984
5006
"<code> application/xml</code> ", <a for=Document>URL</a> is "<code> about:blank</code> ",
4985
5007
<a for=Document>origin</a> is an <a>opaque origin</a> ,
4986
- <a for=Document>type</a> is "<code> xml</code> ", and its
4987
- <a for=Document>mode </a> is " <code> no-quirks </code> " .
5008
+ <a for=Document>type</a> is "<code> xml</code> ", <a for=Document>mode</a> is " <code> no-quirks </code> ",
5009
+ and <a for=Document>allow declarative shadow roots </a> is false .
4988
5010
4989
5011
<p> A <a>document</a> is said to be an <dfn export>XML document</dfn> if its <a for=Document>type</a>
4990
5012
is "<code> xml</code> "; otherwise an <dfn export>HTML document</dfn> . Whether a <a>document</a> is an
@@ -5857,13 +5879,19 @@ It is initially set to false.</p>
5857
5879
<p> <a for=/>Shadow roots</a> have an associated
5858
5880
<dfn export for=ShadowRoot>available to element internals</dfn> . It is initially set to false.</p>
5859
5881
5882
+ <p> <a for=/>Shadow roots</a> have an associated <dfn export for=ShadowRoot>declarative</dfn>
5883
+ (a boolean). It is initially set to false.</p>
5884
+
5860
5885
<p> <a for=/>Shadow roots</a> 's associated <a for=DocumentFragment>host</a> is never null.</p>
5861
5886
<!-- If we ever change this, e.g., add a ShadowRoot object constructor, that would have serious
5862
5887
consequences for innerHTML. -->
5863
5888
5864
5889
<p> <a for=/>Shadow roots</a> have an associated <dfn for=ShadowRoot>slot assignment</dfn>
5865
5890
("<code> manual</code> " or "<code> named</code> ").
5866
5891
5892
+ <p> <a for=/>Shadow roots</a> have an associated <dfn for=ShadowRoot>clonable</dfn> (a boolean).
5893
+ It is initially set to false.</p>
5894
+
5867
5895
<p> A <a for=/>shadow root</a> 's <a>get the parent</a> algorithm, given an <var> event</var> , returns
5868
5896
null if <var> event</var> 's <a>composed flag</a> is unset and <a for=/>shadow root</a> is the
5869
5897
<a for=tree>root</a> of <var> event</var> 's <a for=Event>path</a>' s first struct's
@@ -6010,6 +6038,7 @@ dictionary ShadowRootInit {
6010
6038
required ShadowRootMode mode;
6011
6039
boolean delegatesFocus = false;
6012
6040
SlotAssignmentMode slotAssignment = "named";
6041
+ boolean clonable = false;
6013
6042
};
6014
6043
</pre>
6015
6044
@@ -6857,23 +6886,38 @@ are:
6857
6886
"<code> span</code> "
6858
6887
</ul>
6859
6888
6889
+ <div algorithm>
6860
6890
<p> The <dfn method for=Element><code>attachShadow(<var>init</var>)</code></dfn> method steps are:
6861
6891
6862
6892
<ol>
6863
- <li><p> If <a>this</a> 's <a for=Element>namespace</a> is not the <a>HTML namespace</a> ,
6893
+ <li><p> Run <a>attach a shadow root</a> with <a>this</a> , <var> init</var> ["{{ShadowRootInit/mode}}"] ,
6894
+ <var> init</var> ["{{ShadowRootInit/clonable}}"] , <var> init</var> ["{{ShadowRootInit/delegatesFocus}}"] ,
6895
+ and <var> init</var> ["{{ShadowRootInit/slotAssignment}}"] .
6896
+
6897
+ <li><p> Return <a>this</a> 's <a for=Element>shadow root</a> .
6898
+ </ol>
6899
+ </div>
6900
+
6901
+ <div algorithm>
6902
+ <p> To <dfn id=concept-attach-a-shadow-root>attach a shadow root</dfn> , given an
6903
+ <a for=/>element</a> <var> element</var> , a string <var> mode</var> , a boolean <var> clonable</var> ,
6904
+ a boolean <var> delegatesFocus</var> , and a boolean <var> slotAssignment</var> :
6905
+
6906
+ <ol>
6907
+ <li><p> If <var> element</var> 's <a for=Element>namespace</a> is not the <a>HTML namespace</a> ,
6864
6908
then <a>throw</a> a "{{NotSupportedError!!exception}} " {{DOMException}} .
6865
6909
6866
6910
<li><p> If <a>this</a> 's <a for=Element>local name</a> is not a <a>valid shadow host name</a> , then
6867
6911
<a>throw</a> a "{{NotSupportedError!!exception}} " {{DOMException}} .
6868
6912
6869
6913
<li>
6870
- <p> If <a>this</a > 's <a for=Element>local name</a> is a <a>valid custom element name</a> , or
6871
- <a>this</a > 's <a for=Element><code>is</code> value</a> is not null, then:
6914
+ <p> If <var> element </var > 's <a for=Element>local name</a> is a <a>valid custom element name</a> , or
6915
+ <var> element </var > 's <a for=Element><code>is</code> value</a> is non- null, then:
6872
6916
6873
6917
<ol>
6874
6918
<li><p> Let <var> definition</var> be the result of
6875
6919
<a lt="look up a custom element definition">looking up a custom element definition</a> given
6876
- <a>this</a > 's <a for=Node>node document</a> , its <a for=Element>namespace</a> , its
6920
+ <var> element </var > 's <a for=Node>node document</a> , its <a for=Element>namespace</a> , its
6877
6921
<a for=Element>local name</a> , and its <a for=Element><code>is</code> value</a> .
6878
6922
6879
6923
<li><p> If <var> definition</var> is not null and <var> definition</var> 's
@@ -6882,38 +6926,52 @@ are:
6882
6926
</ol>
6883
6927
</li>
6884
6928
6885
- <li><p> If <a>this</a> is a <a for=Element>shadow host</a> , then <a>throw</a> an
6886
- "{{NotSupportedError!!exception}} " {{DOMException}} .
6929
+ <li>
6930
+ <p> If <var> element</var> is a <a for=Element>shadow host</a> , then:
6931
+
6932
+ <ol>
6933
+ <li><p> If <var> element</var> 's <a for=Element>shadow root</a>' s <a for=ShadowRoot>declarative</a>
6934
+ is false, then <a>throw</a> an "{{NotSupportedError!!exception}} " {{DOMException}} .
6935
+
6936
+ <li><p> Otherwise, <a for=/>remove</a> all of <var> element</var> 's
6937
+ <a for=Element>shadow root</a> 's <a>children</a> , in <a>tree order</a> , and return.
6938
+
6939
+ <p class=note> This means that if multiple declarative shadow roots are contained within a single
6940
+ shadow host, only the last one will remain.
6941
+ </ol>
6887
6942
6888
6943
<li><p> Let <var> shadow</var> be a new <a for=/>shadow root</a> whose <a for=Node>node document</a>
6889
- is <a>this</a > 's <a for=Node>node document</a> , <a for=DocumentFragment>host</a> is <a>this</a> ,
6890
- and <a for=ShadowRoot>mode</a> is <var> init </var> ["{{ShadowRootInit/mode}}"] .
6944
+ is <var> element </var > 's <a for=Node>node document</a> , <a for=DocumentFragment>host</a> is
6945
+ <var> element </var> , and <a for=ShadowRoot>mode</a> is <var> mode </var> .
6891
6946
6892
- <li><p> Set <var> shadow</var> 's <a for=ShadowRoot>delegates focus</a> to
6893
- <var> init</var> ["{{ShadowRootInit/delegatesFocus}}"] .
6947
+ <li><p> Set <var> shadow</var> 's <a for=ShadowRoot>delegates focus</a> to <var> delegatesFocus</var> .
6894
6948
6895
6949
<li><p> If <a>this</a> 's <a for=Element>custom element state</a> is "<code> precustomized</code> " or
6896
6950
"<code> custom</code> ", then set <var> shadow</var> 's
6897
6951
<a for=ShadowRoot>available to element internals</a> to true.
6898
6952
6899
- <li><p> Set <var> shadow</var> 's <a for=ShadowRoot>slot assignment</a> to
6900
- <var> init</var> ["{{ShadowRootInit/slotAssignment}}"] .
6953
+ <li><p> Set <var> shadow</var> 's <a for=ShadowRoot>slot assignment</a> to <var> slotAssignment</var> .
6901
6954
6902
- <li><p> Set <a>this</a > 's <a for=Element>shadow root </a> to <var> shadow </var> .
6955
+ <li><p> Set <var> shadow </var > 's <a for=ShadowRoot>declarative </a> to false .
6903
6956
6904
- <li><p> Return <var> shadow</var> .
6957
+ <li><p> Set <var> shadow</var> 's <a for=ShadowRoot>clonable</a> to <var> clonable</var> .
6958
+
6959
+ <li><p> Set <var> element</var> 's <a for=Element>shadow root</a> to <var> shadow</var> .
6905
6960
</ol>
6961
+ </div>
6906
6962
6963
+ <div algorithm>
6907
6964
<p> The <dfn attribute for=Element><code>shadowRoot</code></dfn> getter steps are:
6908
6965
6909
6966
<ol>
6910
6967
<li><p> Let <var> shadow</var> be <a>this</a> 's <a for=Element>shadow root</a> .
6911
6968
6912
6969
<li><p> If <var> shadow</var> is null or its <a for=ShadowRoot>mode</a> is "<code> closed</code> ",
6913
- then return null.</p></li>
6970
+ then return null.
6914
6971
6915
6972
<li><p> Return <var> shadow</var> .
6916
6973
</ol>
6974
+ </div>
6917
6975
6918
6976
<hr>
6919
6977
@@ -10223,7 +10281,7 @@ Manish Tripathi,
10223
10281
Marcos Caceres,
10224
10282
Mark Miller,
10225
10283
Martijn van der Ven,
10226
- Mason Freed,
10284
+ Mason Freed,<!-- mfreed7; GitHub -->
10227
10285
Mats Palmgren,
10228
10286
Mounir Lamouri,
10229
10287
Michael Stramel,
0 commit comments