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