@@ -2907,6 +2907,11 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
29072907 <li><dfn data-x-href="https://dom.spec.whatwg.org/#interface-element"><code>Element</code></dfn> interface</li>
29082908 <li><dfn data-x="dom-Element-attachShadow" data-x-href="https://dom.spec.whatwg.org/#dom-element-attachshadow"><code>attachShadow()</code></dfn> method.</li>
29092909 <li>An element's <dfn data-x="concept-element-shadow-root" data-x-href="https://dom.spec.whatwg.org/#concept-element-shadow-root">shadow root</dfn></li>
2910+ <li>A <span data-x="concept-element-shadow-root">shadow root</span>'s <dfn data-x="concept-shadow-root-mode" data-x-href="https://dom.spec.whatwg.org/#shadowroot-mode">mode</dfn></li>
2911+ <li>A <span data-x="concept-element-shadow-root">shadow root</span>'s <dfn data-x="concept-is-declarative-shadow-root" data-x-href="https://dom.spec.whatwg.org/#dom-is-declarative-shadow-root">is declarative shadow root</dfn> flag</li>
2912+ <li>The <dfn data-x="concept-attach-a-shadow-root" data-x-href="https://dom.spec.whatwg.org/#concept-attach-a-shadow-root">attach a
2913+ shadow root</dfn> algorithm</li>
2914+ <li>The <dfn data-x="dom-element-shadowroot" data-x-href="https://dom.spec.whatwg.org/#dom-element-shadowroot">shadowRoot</dfn> attribute</li>
29102915 <li>The <dfn data-x="dom-retarget" data-x-href="https://dom.spec.whatwg.org/#retarget">retargeting algorithm</dfn></li>
29112916 <li><dfn data-x-href="https://dom.spec.whatwg.org/#interface-node"><code>Node</code></dfn> interface</li>
29122917 <li><dfn data-x-href="https://dom.spec.whatwg.org/#interface-nodelist"><code>NodeList</code></dfn> interface</li>
@@ -2917,7 +2922,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
29172922 <li><dfn data-x-href="https://dom.spec.whatwg.org/#concept-node-document">node document</dfn> concept</li>
29182923 <li><dfn data-x="concept-document-type" data-x-href="https://dom.spec.whatwg.org/#concept-document-type">document type</dfn> concept</li>
29192924 <li><dfn data-x="concept-DocumentFragment-host" data-x-href="https://dom.spec.whatwg.org/#concept-documentfragment-host">host</dfn> concept</li>
2920- <li>The <dfn data-x-href="https://dom.spec.whatwg.org/#concept-shadow-root">shadow root</dfn> concept, and its <dfn data-x-href="https://dom.spec.whatwg.org/#shadowroot-delegates-focus">delegates focus</dfn></li>
2925+ <li>The <dfn data-x="concept-shadow-root" data-x -href="https://dom.spec.whatwg.org/#concept-shadow-root">shadow root</dfn> concept, and its <dfn data-x-href="https://dom.spec.whatwg.org/#shadowroot-delegates-focus">delegates focus</dfn></li>
29212926 <li>The <dfn data-x-href="https://dom.spec.whatwg.org/#element-shadow-host">shadow host</dfn> concept</li>
29222927 <li><dfn data-x-href="https://dom.spec.whatwg.org/#interface-htmlcollection"><code>HTMLCollection</code></dfn> interface, its
29232928 <dfn data-x="dom-HTMLCollection-length" data-x-href="https://dom.spec.whatwg.org/#dom-htmlcollection-length"><code>length</code></dfn> attribute, and its
@@ -15087,7 +15092,7 @@ interface <dfn>HTMLStyleElement</dfn> : <span>HTMLElement</span> {
1508715092 <li><p>If <var>element</var> has an <span>associated CSS style sheet</span>, <span
1508815093 data-x="remove a CSS style sheet">remove the CSS style sheet</span> in question.</p></li>
1508915094
15090- <li><p>If <var>element</var>'s <span>root</span> is neither a <span>shadow root</span> nor a
15095+ <li><p>If <var>element</var>'s <span>root</span> is neither a <span data-x="concept-element-shadow-root" >shadow root</span> nor a
1509115096 <span>document</span>, then return.</p></li>
1509215097 <!-- https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=2740
1509315098 Also, per https://github.com/w3c/webcomponents/issues/56 stylesheets should work in
@@ -54438,7 +54443,7 @@ MIT Room 32-G524
5443854443 <p>A user agent prefilling a form control must not discriminate between form controls that are
5443954444 <span>in a document tree</span> and those that are <span>connected</span>; that is, it is not
5444054445 conforming to make the decision on whether or not to autofill based on whether the element's
54441- <span>root</span> is a <span>shadow root</span> versus a <code>Document</code>.</p>
54446+ <span>root</span> is a <span data-x="concept-element-shadow-root" >shadow root</span> versus a <code>Document</code>.</p>
5444254447
5444354448 <p>A user agent prefilling a form control's <span data-x="concept-fe-value">value</span> must not
5444454449 cause that control to <span data-x="suffering from a type mismatch">suffer from a type
@@ -58555,8 +58560,8 @@ o............A....e
5855558560 set.</p></li>
5855658561
5855758562 <li>
58558- <p>If <var>scriptElement</var>'s <span>root</span> is <em>not</em> a <span>shadow
58559- root</span>, then set <var>document</var>'s <code
58563+ <p>If <var>scriptElement</var>'s <span>root</span> is <em>not</em> a
58564+ <span data-x="concept-element-shadow-root">shadow root</span>, then set <var>document</var>'s <code
5856058565 data-x="dom-document-currentScript">currentScript</code> attribute to
5856158566 <var>scriptElement</var>. Otherwise, set it to null.</p>
5856258567
@@ -59047,7 +59052,8 @@ interface <dfn>HTMLTemplateElement</dfn> : <span>HTMLElement</span> {
5904759052 [<span>HTMLConstructor</span>] constructor();
5904859053
5904959054 readonly attribute <span>DocumentFragment</span> <span data-x="dom-template-content">content</span>;
59050- readonly attribute ShadowRoot? <span data-x="dom-template-shadowroot">shadowRoot</span>;
59055+ readonly attribute <span data-x="concept-shadow-root">ShadowRoot</span>? <span data-x="dom-template-shadowroot">shadowRoot</span>;
59056+
5905159057};</code></pre>
5905259058</dd>
5905359059 <dd w-dev>Uses <code>HTMLTemplateElement</code>.</dd>
@@ -59198,16 +59204,23 @@ interface <dfn>HTMLTemplateElement</dfn> : <span>HTMLElement</span> {
5919859204
5919959205 <p>The <dfn attribute for="HTMLTemplateElement"><code
5920059206 data-x="dom-template-content">content</code></dfn> IDL attribute must return the
59201- <code>template</code> element's <span>template contents</span>. If the <code>template</code>'s
59202- <a href="https://dom.spec.whatwg.org/#dom-is-declarative-shadow-root">is declarative shadow root</a>
59203- property is true, then the <code data-x="dom-template-content">content</code> attribute must return
59204- null instead.</p>
59207+ result of running the <span>get template contents algorithm</span>.</p>
5920559208
5920659209 <p>The <dfn><code data-x="dom-template-shadowroot">shadowroot</code></dfn> IDL attribute must return
59207- its base Element 's <a href="https:// dom.spec.whatwg.org/#dom -element-shadowroot">shadowroot</a> value .
59210+ the value of the <code>template</code> element 's <span data-x=" dom-element-shadowroot">shadowRoot</span> attribute .
5920859211
5920959212 <hr>
5921059213
59214+ <p>The <dfn>get template contents algorithm</dfn>, which is passed a <var>template</var> (a
59215+ <code>template</code> element) consists of running these steps:</p>
59216+
59217+ <ol>
59218+ <li><p>If the <code>template</code>'s <span data-x="concept-is-declarative-shadow-root">is declarative shadow root</span>
59219+ property is true, then return null.</p></li>
59220+
59221+ <li><p>Otherwise, return <code>template</code>'s <span>template contents</span>.</p></li>
59222+ </ol>
59223+
5921159224 <p>The <span data-x="concept-node-clone-ext">cloning steps</span> for a <code>template</code>
5921259225 element <var>node</var> being cloned to a copy <var>copy</var> must run the
5921359226 following steps:</p>
@@ -66089,7 +66102,7 @@ console.log(plasticButton.outerHTML); // will output '<button is="plastic-but
6608966102 is truly one-time will need a guard to prevent it from running twice.</p></li>
6609066103
6609166104 <li><p>In general, the constructor should be used to set up initial state and default values, and
66092- to set up event listeners and possibly a <span>shadow root</span>.</p></li>
66105+ to set up event listeners and possibly a <span data-x="concept-element-shadow-root" >shadow root</span>.</p></li>
6609366106 </ul>
6609466107
6609566108 <p>Several of these requirements are checked during <span data-x="create an element">element
@@ -72863,7 +72876,7 @@ END:VCARD</pre>
7286372876 <li><p>If <var>element</var>'s parent is a <span>shadow host</span>, then return
7286472877 <var>element</var>'s <span>assigned slot</span>.</p></li>
7286572878
72866- <li><p>If <var>element</var>'s parent is a <span>shadow root</span>, then return the parent's
72879+ <li><p>If <var>element</var>'s parent is a <span data-x="concept-element-shadow-root" >shadow root</span>, then return the parent's
7286772880 <span data-x="concept-DocumentFragment-host">host</span>.</p></li>
7286872881
7286972882 <li><p>If <var>element</var>'s parent is the <span>document element</span>, then return the
@@ -108635,24 +108648,24 @@ document.body.appendChild(text);
108635108648
108636108649 <li><p>If the start tag for the <span data-x="concept-declarative-template-element">declarative template element</span> had an attribute with the name "shadowrootdelegatesfocus", then let <dfn><var data-x="concept-declarative-shadow-delegates-focus">declarative shadow delegates focus</var></dfn> be true. Otherwise let it be false.</p></li>
108637108650
108638- <li><p>Run <a href="https://dom.spec.whatwg.org/# concept-attach-a-shadow-root">attach a shadow root</a > with <var>shadow host</var>
108651+ <li><p>Run <span data-x=" concept-attach-a-shadow-root">attach a shadow root</span > with <var>shadow host</var>
108639108652 equal to <span data-x="concept-declarative-shadow-host-element">declarative shadow host element</span>,
108640108653 <var>mode</var> equal to <span data-x="concept-declarative-shadow-mode">declarative shadow mode</span>, and
108641108654 <span>delegates focus</span> equal to <span data-x="concept-declarative-shadow-delegates-focus">declarative shadow delegates focus</span>.</p></li>
108642108655
108643- <p>If an exception was thrown by <a href="https://dom.spec.whatwg.org/# concept-attach-a-shadow-root">attach a shadow root</a>,
108644- catch it, and <span>report the exception</span> .</p>
108656+ <p>If an exception was thrown by <span data-x=" concept-attach-a-shadow-root">attach a shadow root</span>, catch it.
108657+ The exception may be reported to a developer console .</p>
108645108658
108646108659 <li><p>Otherwise, run these steps:</p>
108647108660
108648108661 <ol>
108662+ <li><p>Set <span data-x="concept-declarative-shadow-host-element">declarative shadow host element</span>'s
108663+ <span data-x="concept-element-shadow-root">shadow root</span>'s
108664+ <span data-x="concept-is-declarative-shadow-root">is declarative shadow root</span> property to true.</p></li>
108649108665
108650- <li><p>Set <span data-x="concept-declarative-shadow-host-element">declarative shadow host element</span>'s <a href="https://dom.spec.whatwg.org/#concept-element-shadow-root">shadow host</a>'s
108651- <a href="https://dom.spec.whatwg.org/#dom-is-declarative-shadow-root">is declarative shadow root</a> property to true.</p></li>
108652-
108653- <li><p><a href="https://dom.spec.whatwg.org/#concept-node-append">Append</a> the <span data-x="concept-declarative-template-element">declarative template element</span>'s DocumentFragment to the newly-created shadow root.</p></li>
108666+ <li><p><span data-x="concept-node-append">Append</span> the <span data-x="concept-declarative-template-element">declarative template element</span>'s DocumentFragment to the newly-created shadow root.</p></li>
108654108667
108655- <li><p><a href="https://dom.spec.whatwg.org/# concept-node-remove">Remove</a > the <span data-x="concept-declarative-template-element">declarative template element</span> from the document.</p></li>
108668+ <li><p><span data-x=" concept-node-remove">Remove</span > the <span data-x="concept-declarative-template-element">declarative template element</span> from the document.</p></li>
108656108669 </ol>
108657108670 </li>
108658108671
@@ -112146,7 +112159,8 @@ document.body.appendChild(text);
112146112159 <p>The following steps form the <!--en-GB--><dfn id="html-fragment-serialisation-algorithm"
112147112160 export>HTML fragment serialization algorithm</dfn>. The algorithm takes as input a DOM
112148112161 <code>Element</code>, <code>Document</code>, or <code>DocumentFragment</code> referred to as
112149- <var>the node</var>, and a boolean referred to as <var>include shadow roots</var> whose default value is false, and returns a string.</p>
112162+ <var>the node</var>, a boolean referred to as <var>include shadow roots</var>, and a
112163+ sequence<ShadowRoot> referred to as <var>closed shadow roots</var>, and returns a string.</p>
112150112164
112151112165 <p class="note">This algorithm serializes the <em>children</em> of the node being serialized, not
112152112166 the node itself.</p>
@@ -112319,39 +112333,36 @@ document.body.appendChild(text);
112319112333 true, then:
112320112334
112321112335 <ol>
112322- <li><p>Append the literal string "<code data-x=""><template shadowroot="</code>" (U+003C LESS-THAN SIGN,
112323- U+0074 LATIN SMALL LETTER T, U+0065 LATIN SMALL LETTER E, U+006D LATIN SMALL LETTER M,
112324- U+0070 LATIN SMALL LETTER P, U+006C LATIN SMALL LETTER L, U+0061 LATIN SMALL LETTER A,
112325- U+0074 LATIN SMALL LETTER T, U+0065 LATIN SMALL LETTER E, U+0020 SPACE,
112326- U+0073 LATIN SMALL LETTER S, U+0068 LATIN SMALL LETTER H, U+0061 LATIN SMALL LETTER A,
112327- U+0064 LATIN SMALL LETTER D, U+006F LATIN SMALL LETTER O, U+0077 LATIN SMALL LETTER W,
112328- U+003D EQUALS SIGN, U+0022 QUOTATION MARK).</p></li>
112329-
112330- <li><p>If <var>shadow root</var>'s <a href="https://dom.spec.whatwg.org/#shadowroot-mode">mode</a>
112331- is "open", then append the literal
112332- string "<code data-x="">open</code>" (U+006F LATIN SMALL LETTER O, U+0070 LATIN SMALL LETTER P,
112333- U+0065 LATIN SMALL LETTER E, U+006E LATIN SMALL LETTER N).</p></li>
112334-
112335- <li><p>If <var>shadow root</var>'s <a href="https://dom.spec.whatwg.org/#shadowroot-mode">mode</a>
112336- is "closed", then append the literal
112337- string "<code data-x="">closed</code>" (U+0063 LATIN SMALL LETTER C, U+006C LATIN SMALL LETTER L,
112338- U+006F LATIN SMALL LETTER O, U+0073 LATIN SMALL LETTER S, U+0065 LATIN SMALL LETTER E,
112339- U+0064 LATIN SMALL LETTER D).</p></li>
112340-
112341- <li><p>Append the literal string "<code data-x="">"></code>" (U+0022 QUOTATION MARK,
112342- U+003E GREATER-THAN SIGN).</p></li>
112343-
112344- <li><p>Append the value of running the <span>HTML fragment serialization algorithm</span> on the
112345- <var>shadow root</var> element (thus recursing into this algorithm for that
112346- element).</p></li>
112347-
112348- <li><p>Append the literal string "<code data-x=""></template></code>" (U+003C LESS-THAN SIGN, U+002F SOLIDUS,
112349- U+0074 LATIN SMALL LETTER T, U+0065 LATIN SMALL LETTER E, U+006D LATIN SMALL LETTER M,
112350- U+0070 LATIN SMALL LETTER P, U+006C LATIN SMALL LETTER L, U+0061 LATIN SMALL LETTER A,
112351- U+0074 LATIN SMALL LETTER T, U+0065 LATIN SMALL LETTER E, U+003E GREATER-THAN SIGN).</p></li>
112336+ <li><p>Let <var>shadow root</var> be equal to <var>the node</var>'s <span data-x="concept-element-shadow-root">shadow root</span>.
112337+
112338+ <li><p>If <var>shadow root</var>'s <span data-x="concept-shadow-root-mode">mode</span>
112339+ is "closed", and <var>shadow root</var> is <b>not</b> contained in <var>closed shadow roots</var>,
112340+ then skip the next step.
112352112341
112342+ <li><p>Otherwise:
112343+
112344+ <ol>
112345+ <li><p>Append the literal string "<code data-x=""><template shadowroot="</code>".</p></li>
112346+
112347+ <li><p>If <var>shadow root</var>'s <span data-x="concept-shadow-root-mode">mode</span>
112348+ is "open", then append the literal
112349+ string "<code data-x="">open</code>".</p></li>
112350+
112351+ <li><p>If <var>shadow root</var>'s <span data-x="concept-shadow-root-mode">mode</span>
112352+ is "closed", then append the literal
112353+ string "<code data-x="">closed</code>".</p></li>
112354+
112355+ <li><p>Append the literal string "<code data-x="">"></code>".</p></li>
112356+
112357+ <li><p>Append the value of running the <span>HTML fragment serialization algorithm</span> on the
112358+ <var>shadow root</var> <code>DocumentFragment</code> (thus recursing into this algorithm for that
112359+ element).</p></li>
112360+
112361+ <li><p>Append the literal string "<code data-x=""></template></code>".</p></li>
112362+
112363+ </ol>
112353112364 </ol>
112354- </li>
112365+ </li>
112355112366
112356112367 <li><p>Return <var>s</var>.</p></li>
112357112368 </ol>
0 commit comments