@@ -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
5009
+ " <code> no-quirks </code> ", and its < 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,39 @@ 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> ,
6894
+ <var> init</var> ["{{ShadowRootInit/mode}}"] , <var> init</var> ["{{ShadowRootInit/clonable}}"] ,
6895
+ <var> init</var> ["{{ShadowRootInit/delegatesFocus}}"] , and
6896
+ <var> init</var> ["{{ShadowRootInit/slotAssignment}}"] .
6897
+
6898
+ <li><p> Return <a>this</a> 's <a for=Element>shadow root</a> .
6899
+ </ol>
6900
+ </div>
6901
+
6902
+ <div algorithm>
6903
+ <p> To <dfn id=concept-attach-a-shadow-root>attach a shadow root</dfn> , given an
6904
+ <a for=/>element</a> <var> element</var> , a string <var> mode</var> , a boolean <var> clonable</var> ,
6905
+ a boolean <var> delegatesFocus</var> , and a boolean <var> slotAssignment</var> :
6906
+
6907
+ <ol>
6908
+ <li><p> If <var> element</var> 's <a for=Element>namespace</a> is not the <a>HTML namespace</a> ,
6864
6909
then <a>throw</a> a "{{NotSupportedError!!exception}} " {{DOMException}} .
6865
6910
6866
- <li><p> If <a>this</a > 's <a for=Element>local name</a> is not a <a>valid shadow host name</a> , then
6867
- <a>throw</a> a "{{NotSupportedError!!exception}} " {{DOMException}} .
6911
+ <li><p> If <var> element </var > 's is not a <a>valid shadow host name</a> , then <a>throw</a> a
6912
+ "{{NotSupportedError!!exception}} " {{DOMException}} .
6868
6913
6869
6914
<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:
6915
+ <p> If <var> element </var > 's <a for=Element>local name</a> is a <a>valid custom element name</a> , or
6916
+ <var> element </var > 's <a for=Element><code>is</code> value</a> is non- null, then:
6872
6917
6873
6918
<ol>
6874
6919
<li><p> Let <var> definition</var> be the result of
6875
6920
<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
6921
+ <var> element </var > 's <a for=Node>node document</a> , its <a for=Element>namespace</a> , its
6877
6922
<a for=Element>local name</a> , and its <a for=Element><code>is</code> value</a> .
6878
6923
6879
6924
<li><p> If <var> definition</var> is not null and <var> definition</var> 's
@@ -6882,38 +6927,53 @@ are:
6882
6927
</ol>
6883
6928
</li>
6884
6929
6885
- <li><p> If <a>this</a> is a <a for=Element>shadow host</a> , then <a>throw</a> an
6886
- "{{NotSupportedError!!exception}} " {{DOMException}} .
6930
+ <li>
6931
+ <p> If <var> element</var> is a <a for=Element>shadow host</a> , then:
6932
+
6933
+ <ol>
6934
+ <li><p> If <var> element</var> 's <a for=Element>shadow root</a>' s <a for=ShadowRoot>declarative</a>
6935
+ is false, then <a>throw</a> an "{{NotSupportedError!!exception}} " {{DOMException}} .
6936
+
6937
+ <li>
6938
+ <p> Otherwise, <a for=/>remove</a> all of <var> element</var> 's <a for=Element>shadow root</a>' s
6939
+ <a for=tree>children</a> , in <a>tree order</a> , and return.
6940
+
6941
+ <p class=note> This means that if multiple declarative shadow roots are contained within a single
6942
+ shadow host, only the last one will remain.
6943
+ </ol>
6887
6944
6888
6945
<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}}"] .
6946
+ is <var> element </var > 's <a for=Node>node document</a> , <a for=DocumentFragment>host</a> is
6947
+ <var> element </var> , and <a for=ShadowRoot>mode</a> is <var> mode </var> .
6891
6948
6892
- <li><p> Set <var> shadow</var> 's <a for=ShadowRoot>delegates focus</a> to
6893
- <var> init</var> ["{{ShadowRootInit/delegatesFocus}}"] .
6949
+ <li><p> Set <var> shadow</var> 's <a for=ShadowRoot>delegates focus</a> to <var> delegatesFocus</var> .
6894
6950
6895
- <li><p> If <a>this</a > 's <a for=Element>custom element state</a> is " <code> precustomized </code> " or
6896
- "<code> custom</code> ", then set <var> shadow</var> 's
6951
+ <li><p> If <var> element </var > 's <a for=Element>custom element state</a> is
6952
+ "<code> precustomized </code> " or " <code> custom</code> ", then set <var> shadow</var> 's
6897
6953
<a for=ShadowRoot>available to element internals</a> to true.
6898
6954
6899
- <li><p> Set <var> shadow</var> 's <a for=ShadowRoot>slot assignment</a> to
6900
- <var> init</var> ["{{ShadowRootInit/slotAssignment}}"] .
6955
+ <li><p> Set <var> shadow</var> 's <a for=ShadowRoot>slot assignment</a> to <var> slotAssignment</var> .
6901
6956
6902
- <li><p> Set <a>this</a > 's <a for=Element>shadow root </a> to <var> shadow </var> .
6957
+ <li><p> Set <var> shadow </var > 's <a for=ShadowRoot>declarative </a> to false .
6903
6958
6904
- <li><p> Return <var> shadow</var> .
6959
+ <li><p> Set <var> shadow</var> 's <a for=ShadowRoot>clonable</a> to <var> clonable</var> .
6960
+
6961
+ <li><p> Set <var> element</var> 's <a for=Element>shadow root</a> to <var> shadow</var> .
6905
6962
</ol>
6963
+ </div>
6906
6964
6965
+ <div algorithm>
6907
6966
<p> The <dfn attribute for=Element><code>shadowRoot</code></dfn> getter steps are:
6908
6967
6909
6968
<ol>
6910
6969
<li><p> Let <var> shadow</var> be <a>this</a> 's <a for=Element>shadow root</a> .
6911
6970
6912
6971
<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>
6972
+ then return null.
6914
6973
6915
6974
<li><p> Return <var> shadow</var> .
6916
6975
</ol>
6976
+ </div>
6917
6977
6918
6978
<hr>
6919
6979
@@ -10223,7 +10283,7 @@ Manish Tripathi,
10223
10283
Marcos Caceres,
10224
10284
Mark Miller,
10225
10285
Martijn van der Ven,
10226
- Mason Freed,
10286
+ Mason Freed,<!-- mfreed7; GitHub -->
10227
10287
Mats Palmgren,
10228
10288
Mounir Lamouri,
10229
10289
Michael Stramel,
0 commit comments