@@ -2885,6 +2885,11 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
28852885 <li><dfn data-x-href="https://dom.spec.whatwg.org/#interface-element"><code>Element</code></dfn> interface</li>
28862886 <li><dfn data-x="dom-Element-attachShadow" data-x-href="https://dom.spec.whatwg.org/#dom-element-attachshadow"><code>attachShadow()</code></dfn> method.</li>
28872887 <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>
2888+ <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>
2889+ <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>
2890+ <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
2891+ shadow root</dfn> algorithm</li>
2892+ <li>The <dfn data-x="dom-element-shadowroot" data-x-href="https://dom.spec.whatwg.org/#dom-element-shadowroot">shadowRoot</dfn> attribute</li>
28882893 <li>The <dfn data-x="dom-retarget" data-x-href="https://dom.spec.whatwg.org/#retarget">retargeting algorithm</dfn></li>
28892894 <li><dfn data-x-href="https://dom.spec.whatwg.org/#interface-node"><code>Node</code></dfn> interface</li>
28902895 <li><dfn data-x-href="https://dom.spec.whatwg.org/#interface-nodelist"><code>NodeList</code></dfn> interface</li>
@@ -2895,7 +2900,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
28952900 <li><dfn data-x-href="https://dom.spec.whatwg.org/#concept-node-document">node document</dfn> concept</li>
28962901 <li><dfn data-x="concept-document-type" data-x-href="https://dom.spec.whatwg.org/#concept-document-type">document type</dfn> concept</li>
28972902 <li><dfn data-x="concept-DocumentFragment-host" data-x-href="https://dom.spec.whatwg.org/#concept-documentfragment-host">host</dfn> concept</li>
2898- <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>
2903+ <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>
28992904 <li>The <dfn data-x-href="https://dom.spec.whatwg.org/#element-shadow-host">shadow host</dfn> concept</li>
29002905 <li><dfn data-x-href="https://dom.spec.whatwg.org/#interface-htmlcollection"><code>HTMLCollection</code></dfn> interface, its
29012906 <dfn data-x="dom-HTMLCollection-length" data-x-href="https://dom.spec.whatwg.org/#dom-htmlcollection-length"><code>length</code></dfn> attribute, and its
@@ -14795,7 +14800,7 @@ interface <dfn>HTMLStyleElement</dfn> : <span>HTMLElement</span> {
1479514800 <li><p>If <var>element</var> has an <span>associated CSS style sheet</span>, <span
1479614801 data-x="remove a CSS style sheet">remove the CSS style sheet</span> in question.</p></li>
1479714802
14798- <li><p>If <var>element</var>'s <span>root</span> is neither a <span>shadow root</span> nor a
14803+ <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
1479914804 <span>document</span>, then return.</p></li>
1480014805 <!-- https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=2740
1480114806 Also, per https://github.com/w3c/webcomponents/issues/56 stylesheets should work in
@@ -53852,7 +53857,7 @@ MIT Room 32-G524
5385253857 <p>A user agent prefilling a form control must not discriminate between form controls that are
5385353858 <span>in a document tree</span> and those that are <span>connected</span>; that is, it is not
5385453859 conforming to make the decision on whether or not to autofill based on whether the element's
53855- <span>root</span> is a <span>shadow root</span> versus a <code>Document</code>.</p>
53860+ <span>root</span> is a <span data-x="concept-element-shadow-root" >shadow root</span> versus a <code>Document</code>.</p>
5385653861
5385753862 <p>A user agent prefilling a form control's <span data-x="concept-fe-value">value</span> must not
5385853863 cause that control to <span data-x="suffering from a type mismatch">suffer from a type
@@ -57975,8 +57980,8 @@ o............A....e
5797557980 set.</p></li>
5797657981
5797757982 <li>
57978- <p>If <var>scriptElement</var>'s <span>root</span> is <em>not</em> a <span>shadow
57979- root</span>, then set <var>document</var>'s <code
57983+ <p>If <var>scriptElement</var>'s <span>root</span> is <em>not</em> a
57984+ <span data-x="concept-element-shadow-root">shadow root</span>, then set <var>document</var>'s <code
5798057985 data-x="dom-document-currentScript">currentScript</code> attribute to
5798157986 <var>scriptElement</var>. Otherwise, set it to null.</p>
5798257987
@@ -58467,7 +58472,8 @@ interface <dfn>HTMLTemplateElement</dfn> : <span>HTMLElement</span> {
5846758472 [<span>HTMLConstructor</span>] constructor();
5846858473
5846958474 readonly attribute <span>DocumentFragment</span> <span data-x="dom-template-content">content</span>;
58470- readonly attribute ShadowRoot? <span data-x="dom-template-shadowroot">shadowRoot</span>;
58475+ readonly attribute <span data-x="concept-shadow-root">ShadowRoot</span>? <span data-x="dom-template-shadowroot">shadowRoot</span>;
58476+
5847158477};</code></pre>
5847258478</dd>
5847358479 <dd w-dev>Uses <code>HTMLTemplateElement</code>.</dd>
@@ -58617,16 +58623,23 @@ interface <dfn>HTMLTemplateElement</dfn> : <span>HTMLElement</span> {
5861758623 </ol>
5861858624
5861958625 <p>The <dfn><code data-x="dom-template-content">content</code></dfn> IDL attribute must return the
58620- <code>template</code> element's <span>template contents</span>. If the <code>template</code>'s
58621- <a href="https://dom.spec.whatwg.org/#dom-is-declarative-shadow-root">is declarative shadow root</a>
58622- property is true, then the <code data-x="dom-template-content">content</code> attribute must return
58623- null instead.</p>
58626+ result of running the <span>get template contents algorithm</span>.</p>
5862458627
5862558628 <p>The <dfn><code data-x="dom-template-shadowroot">shadowroot</code></dfn> IDL attribute must return
58626- its base Element 's <a href="https:// dom.spec.whatwg.org/#dom -element-shadowroot">shadowroot</a> value .
58629+ the value of the <code>template</code> element 's <span data-x=" dom-element-shadowroot">shadowRoot</span> attribute .
5862758630
5862858631 <hr>
5862958632
58633+ <p>The <dfn>get template contents algorithm</dfn>, which is passed a <var>template</var> (a
58634+ <code>template</code> element) consists of running these steps:</p>
58635+
58636+ <ol>
58637+ <li><p>If the <code>template</code>'s <span data-x="concept-is-declarative-shadow-root">is declarative shadow root</span>
58638+ property is true, then return null.</p></li>
58639+
58640+ <li><p>Otherwise, return <code>template</code>'s <span>template contents</span>.</p></li>
58641+ </ol>
58642+
5863058643 <p>The <span data-x="concept-node-clone-ext">cloning steps</span> for a <code>template</code>
5863158644 element <var>node</var> being cloned to a copy <var>copy</var> must run the
5863258645 following steps:</p>
@@ -65452,7 +65465,7 @@ console.log(plasticButton.outerHTML); // will output '<button is="plastic-but
6545265465 is truly one-time will need a guard to prevent it from running twice.</p></li>
6545365466
6545465467 <li><p>In general, the constructor should be used to set up initial state and default values, and
65455- to set up event listeners and possibly a <span>shadow root</span>.</p></li>
65468+ to set up event listeners and possibly a <span data-x="concept-element-shadow-root" >shadow root</span>.</p></li>
6545665469 </ul>
6545765470
6545865471 <p>Several of these requirements are checked during <span data-x="create an element">element
@@ -72160,7 +72173,7 @@ END:VCARD</pre>
7216072173 <li><p>If <var>element</var>'s parent is a <span>shadow host</span>, then return
7216172174 <var>element</var>'s <span>assigned slot</span>.</p></li>
7216272175
72163- <li><p>If <var>element</var>'s parent is a <span>shadow root</span>, then return the parent's
72176+ <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
7216472177 <span data-x="concept-DocumentFragment-host">host</span>.</p></li>
7216572178
7216672179 <li><p>If <var>element</var>'s parent is the <span>document element</span>, then return the
@@ -106437,24 +106450,24 @@ document.body.appendChild(text);
106437106450
106438106451 <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>
106439106452
106440- <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>
106453+ <li><p>Run <span data-x=" concept-attach-a-shadow-root">attach a shadow root</span > with <var>shadow host</var>
106441106454 equal to <span data-x="concept-declarative-shadow-host-element">declarative shadow host element</span>,
106442106455 <var>mode</var> equal to <span data-x="concept-declarative-shadow-mode">declarative shadow mode</span>, and
106443106456 <span>delegates focus</span> equal to <span data-x="concept-declarative-shadow-delegates-focus">declarative shadow delegates focus</span>.</p></li>
106444106457
106445- <p>If an exception was thrown by <a href="https://dom.spec.whatwg.org/# concept-attach-a-shadow-root">attach a shadow root</a>,
106446- catch it, and <span>report the exception</span> .</p>
106458+ <p>If an exception was thrown by <span data-x=" concept-attach-a-shadow-root">attach a shadow root</span>, catch it.
106459+ The exception may be reported to a developer console .</p>
106447106460
106448106461 <li><p>Otherwise, run these steps:</p>
106449106462
106450106463 <ol>
106464+ <li><p>Set <span data-x="concept-declarative-shadow-host-element">declarative shadow host element</span>'s
106465+ <span data-x="concept-element-shadow-root">shadow root</span>'s
106466+ <span data-x="concept-is-declarative-shadow-root">is declarative shadow root</span> property to true.</p></li>
106451106467
106452- <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
106453- <a href="https://dom.spec.whatwg.org/#dom-is-declarative-shadow-root">is declarative shadow root</a> property to true.</p></li>
106454-
106455- <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>
106468+ <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>
106456106469
106457- <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>
106470+ <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>
106458106471 </ol>
106459106472 </li>
106460106473
@@ -109949,7 +109962,8 @@ document.body.appendChild(text);
109949109962 <p>The following steps form the <!--en-GB--><dfn id="html-fragment-serialisation-algorithm"
109950109963 data-export="">HTML fragment serialization algorithm</dfn>. The algorithm takes as input a DOM
109951109964 <code>Element</code>, <code>Document</code>, or <code>DocumentFragment</code> referred to as
109952- <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>
109965+ <var>the node</var>, a boolean referred to as <var>include shadow roots</var>, and a
109966+ sequence<ShadowRoot> referred to as <var>closed shadow roots</var>, and returns a string.</p>
109953109967
109954109968 <p class="note">This algorithm serializes the <em>children</em> of the node being serialized, not
109955109969 the node itself.</p>
@@ -110122,39 +110136,36 @@ document.body.appendChild(text);
110122110136 true, then:
110123110137
110124110138 <ol>
110125- <li><p>Append the literal string "<code data-x=""><template shadowroot="</code>" (U+003C LESS-THAN SIGN,
110126- U+0074 LATIN SMALL LETTER T, U+0065 LATIN SMALL LETTER E, U+006D LATIN SMALL LETTER M,
110127- U+0070 LATIN SMALL LETTER P, U+006C LATIN SMALL LETTER L, U+0061 LATIN SMALL LETTER A,
110128- U+0074 LATIN SMALL LETTER T, U+0065 LATIN SMALL LETTER E, U+0020 SPACE,
110129- U+0073 LATIN SMALL LETTER S, U+0068 LATIN SMALL LETTER H, U+0061 LATIN SMALL LETTER A,
110130- U+0064 LATIN SMALL LETTER D, U+006F LATIN SMALL LETTER O, U+0077 LATIN SMALL LETTER W,
110131- U+003D EQUALS SIGN, U+0022 QUOTATION MARK).</p></li>
110132-
110133- <li><p>If <var>shadow root</var>'s <a href="https://dom.spec.whatwg.org/#shadowroot-mode">mode</a>
110134- is "open", then append the literal
110135- string "<code data-x="">open</code>" (U+006F LATIN SMALL LETTER O, U+0070 LATIN SMALL LETTER P,
110136- U+0065 LATIN SMALL LETTER E, U+006E LATIN SMALL LETTER N).</p></li>
110137-
110138- <li><p>If <var>shadow root</var>'s <a href="https://dom.spec.whatwg.org/#shadowroot-mode">mode</a>
110139- is "closed", then append the literal
110140- string "<code data-x="">closed</code>" (U+0063 LATIN SMALL LETTER C, U+006C LATIN SMALL LETTER L,
110141- U+006F LATIN SMALL LETTER O, U+0073 LATIN SMALL LETTER S, U+0065 LATIN SMALL LETTER E,
110142- U+0064 LATIN SMALL LETTER D).</p></li>
110143-
110144- <li><p>Append the literal string "<code data-x="">"></code>" (U+0022 QUOTATION MARK,
110145- U+003E GREATER-THAN SIGN).</p></li>
110146-
110147- <li><p>Append the value of running the <span>HTML fragment serialization algorithm</span> on the
110148- <var>shadow root</var> element (thus recursing into this algorithm for that
110149- element).</p></li>
110150-
110151- <li><p>Append the literal string "<code data-x=""></template></code>" (U+003C LESS-THAN SIGN, U+002F SOLIDUS,
110152- U+0074 LATIN SMALL LETTER T, U+0065 LATIN SMALL LETTER E, U+006D LATIN SMALL LETTER M,
110153- U+0070 LATIN SMALL LETTER P, U+006C LATIN SMALL LETTER L, U+0061 LATIN SMALL LETTER A,
110154- U+0074 LATIN SMALL LETTER T, U+0065 LATIN SMALL LETTER E, U+003E GREATER-THAN SIGN).</p></li>
110139+ <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>.
110140+
110141+ <li><p>If <var>shadow root</var>'s <span data-x="concept-shadow-root-mode">mode</span>
110142+ is "closed", and <var>shadow root</var> is <b>not</b> contained in <var>closed shadow roots</var>,
110143+ then skip the next step.
110155110144
110145+ <li><p>Otherwise:
110146+
110147+ <ol>
110148+ <li><p>Append the literal string "<code data-x=""><template shadowroot="</code>".</p></li>
110149+
110150+ <li><p>If <var>shadow root</var>'s <span data-x="concept-shadow-root-mode">mode</span>
110151+ is "open", then append the literal
110152+ string "<code data-x="">open</code>".</p></li>
110153+
110154+ <li><p>If <var>shadow root</var>'s <span data-x="concept-shadow-root-mode">mode</span>
110155+ is "closed", then append the literal
110156+ string "<code data-x="">closed</code>".</p></li>
110157+
110158+ <li><p>Append the literal string "<code data-x="">"></code>".</p></li>
110159+
110160+ <li><p>Append the value of running the <span>HTML fragment serialization algorithm</span> on the
110161+ <var>shadow root</var> <code>DocumentFragment</code> (thus recursing into this algorithm for that
110162+ element).</p></li>
110163+
110164+ <li><p>Append the literal string "<code data-x=""></template></code>".</p></li>
110165+
110166+ </ol>
110156110167 </ol>
110157- </li>
110168+ </li>
110158110169
110159110170 <li><p>Return <var>s</var>.</p></li>
110160110171 </ol>
0 commit comments