Skip to content

Commit 29cdf7e

Browse files
committed
Addressed annevk's comments
1 parent b12280b commit 29cdf7e

1 file changed

Lines changed: 64 additions & 53 deletions

File tree

source

Lines changed: 64 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2900,6 +2900,11 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
29002900
<li><dfn data-x-href="https://dom.spec.whatwg.org/#interface-element"><code>Element</code></dfn> interface</li>
29012901
<li><dfn data-x="dom-Element-attachShadow" data-x-href="https://dom.spec.whatwg.org/#dom-element-attachshadow"><code>attachShadow()</code></dfn> method.</li>
29022902
<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>
2903+
<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>
2904+
<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>
2905+
<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
2906+
shadow root</dfn> algorithm</li>
2907+
<li>The <dfn data-x="dom-element-shadowroot" data-x-href="https://dom.spec.whatwg.org/#dom-element-shadowroot">shadowRoot</dfn> attribute</li>
29032908
<li>The <dfn data-x="dom-retarget" data-x-href="https://dom.spec.whatwg.org/#retarget">retargeting algorithm</dfn></li>
29042909
<li><dfn data-x-href="https://dom.spec.whatwg.org/#interface-node"><code>Node</code></dfn> interface</li>
29052910
<li><dfn data-x-href="https://dom.spec.whatwg.org/#interface-nodelist"><code>NodeList</code></dfn> interface</li>
@@ -2910,7 +2915,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
29102915
<li><dfn data-x-href="https://dom.spec.whatwg.org/#concept-node-document">node document</dfn> concept</li>
29112916
<li><dfn data-x="concept-document-type" data-x-href="https://dom.spec.whatwg.org/#concept-document-type">document type</dfn> concept</li>
29122917
<li><dfn data-x="concept-DocumentFragment-host" data-x-href="https://dom.spec.whatwg.org/#concept-documentfragment-host">host</dfn> concept</li>
2913-
<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>
2918+
<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>
29142919
<li>The <dfn data-x-href="https://dom.spec.whatwg.org/#element-shadow-host">shadow host</dfn> concept</li>
29152920
<li><dfn data-x-href="https://dom.spec.whatwg.org/#interface-htmlcollection"><code>HTMLCollection</code></dfn> interface, its
29162921
<dfn data-x="dom-HTMLCollection-length" data-x-href="https://dom.spec.whatwg.org/#dom-htmlcollection-length"><code>length</code></dfn> attribute, and its
@@ -14943,7 +14948,7 @@ interface <dfn>HTMLStyleElement</dfn> : <span>HTMLElement</span> {
1494314948
<li><p>If <var>element</var> has an <span>associated CSS style sheet</span>, <span
1494414949
data-x="remove a CSS style sheet">remove the CSS style sheet</span> in question.</p></li>
1494514950

14946-
<li><p>If <var>element</var>'s <span>root</span> is neither a <span>shadow root</span> nor a
14951+
<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
1494714952
<span>document</span>, then return.</p></li>
1494814953
<!-- https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=2740
1494914954
Also, per https://github.com/w3c/webcomponents/issues/56 stylesheets should work in
@@ -54178,7 +54183,7 @@ MIT Room 32-G524
5417854183
<p>A user agent prefilling a form control must not discriminate between form controls that are
5417954184
<span>in a document tree</span> and those that are <span>connected</span>; that is, it is not
5418054185
conforming to make the decision on whether or not to autofill based on whether the element's
54181-
<span>root</span> is a <span>shadow root</span> versus a <code>Document</code>.</p>
54186+
<span>root</span> is a <span data-x="concept-element-shadow-root">shadow root</span> versus a <code>Document</code>.</p>
5418254187

5418354188
<p>A user agent prefilling a form control's <span data-x="concept-fe-value">value</span> must not
5418454189
cause that control to <span data-x="suffering from a type mismatch">suffer from a type
@@ -58285,8 +58290,8 @@ o............A....e
5828558290
set.</p></li>
5828658291

5828758292
<li>
58288-
<p>If <var>scriptElement</var>'s <span>root</span> is <em>not</em> a <span>shadow
58289-
root</span>, then set <var>document</var>'s <code
58293+
<p>If <var>scriptElement</var>'s <span>root</span> is <em>not</em> a
58294+
<span data-x="concept-element-shadow-root">shadow root</span>, then set <var>document</var>'s <code
5829058295
data-x="dom-document-currentScript">currentScript</code> attribute to
5829158296
<var>scriptElement</var>. Otherwise, set it to null.</p>
5829258297

@@ -58777,7 +58782,8 @@ interface <dfn>HTMLTemplateElement</dfn> : <span>HTMLElement</span> {
5877758782
[<span>HTMLConstructor</span>] constructor();
5877858783

5877958784
readonly attribute <span>DocumentFragment</span> <span data-x="dom-template-content">content</span>;
58780-
readonly attribute ShadowRoot? <span data-x="dom-template-shadowroot">shadowRoot</span>;
58785+
readonly attribute <span data-x="concept-shadow-root">ShadowRoot</span>? <span data-x="dom-template-shadowroot">shadowRoot</span>;
58786+
5878158787
};</code></pre>
5878258788
</dd>
5878358789
<dd w-dev>Uses <code>HTMLTemplateElement</code>.</dd>
@@ -58927,16 +58933,23 @@ interface <dfn>HTMLTemplateElement</dfn> : <span>HTMLElement</span> {
5892758933
</ol>
5892858934

5892958935
<p>The <dfn><code data-x="dom-template-content">content</code></dfn> IDL attribute must return the
58930-
<code>template</code> element's <span>template contents</span>. If the <code>template</code>'s
58931-
<a href="https://dom.spec.whatwg.org/#dom-is-declarative-shadow-root">is declarative shadow root</a>
58932-
property is true, then the <code data-x="dom-template-content">content</code> attribute must return
58933-
null instead.</p>
58936+
result of running the <span>get template contents algorithm</span>.</p>
5893458937

5893558938
<p>The <dfn><code data-x="dom-template-shadowroot">shadowroot</code></dfn> IDL attribute must return
58936-
its base Element's <a href="https://dom.spec.whatwg.org/#dom-element-shadowroot">shadowroot</a> value.
58939+
the value of the <code>template</code> element's <span data-x="dom-element-shadowroot">shadowRoot</span> attribute.
5893758940

5893858941
<hr>
5893958942

58943+
<p>The <dfn>get template contents algorithm</dfn>, which is passed a <var>template</var> (a
58944+
<code>template</code> element) consists of running these steps:</p>
58945+
58946+
<ol>
58947+
<li><p>If the <code>template</code>'s <span data-x="concept-is-declarative-shadow-root">is declarative shadow root</span>
58948+
property is true, then return null.</p></li>
58949+
58950+
<li><p>Otherwise, return <code>template</code>'s <span>template contents</span>.</p></li>
58951+
</ol>
58952+
5894058953
<p>The <span data-x="concept-node-clone-ext">cloning steps</span> for a <code>template</code>
5894158954
element <var>node</var> being cloned to a copy <var>copy</var> must run the
5894258955
following steps:</p>
@@ -65752,7 +65765,7 @@ console.log(plasticButton.outerHTML); // will output '&lt;button is="plastic-but
6575265765
is truly one-time will need a guard to prevent it from running twice.</p></li>
6575365766

6575465767
<li><p>In general, the constructor should be used to set up initial state and default values, and
65755-
to set up event listeners and possibly a <span>shadow root</span>.</p></li>
65768+
to set up event listeners and possibly a <span data-x="concept-element-shadow-root">shadow root</span>.</p></li>
6575665769
</ul>
6575765770

6575865771
<p>Several of these requirements are checked during <span data-x="create an element">element
@@ -72457,7 +72470,7 @@ END:VCARD</pre>
7245772470
<li><p>If <var>element</var>'s parent is a <span>shadow host</span>, then return
7245872471
<var>element</var>'s <span>assigned slot</span>.</p></li>
7245972472

72460-
<li><p>If <var>element</var>'s parent is a <span>shadow root</span>, then return the parent's
72473+
<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
7246172474
<span data-x="concept-DocumentFragment-host">host</span>.</p></li>
7246272475

7246372476
<li><p>If <var>element</var>'s parent is the <span>document element</span>, then return the
@@ -108164,24 +108177,24 @@ document.body.appendChild(text);
108164108177

108165108178
<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>
108166108179

108167-
<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>
108180+
<li><p>Run <span data-x="concept-attach-a-shadow-root">attach a shadow root</span> with <var>shadow host</var>
108168108181
equal to <span data-x="concept-declarative-shadow-host-element">declarative shadow host element</span>,
108169108182
<var>mode</var> equal to <span data-x="concept-declarative-shadow-mode">declarative shadow mode</span>, and
108170108183
<span>delegates focus</span> equal to <span data-x="concept-declarative-shadow-delegates-focus">declarative shadow delegates focus</span>.</p></li>
108171108184

108172-
<p>If an exception was thrown by <a href="https://dom.spec.whatwg.org/#concept-attach-a-shadow-root">attach a shadow root</a>,
108173-
catch it, and <span>report the exception</span>.</p>
108185+
<p>If an exception was thrown by <span data-x="concept-attach-a-shadow-root">attach a shadow root</span>, catch it.
108186+
The exception may be reported to a developer console.</p>
108174108187

108175108188
<li><p>Otherwise, run these steps:</p>
108176108189

108177108190
<ol>
108191+
<li><p>Set <span data-x="concept-declarative-shadow-host-element">declarative shadow host element</span>'s
108192+
<span data-x="concept-element-shadow-root">shadow root</span>'s
108193+
<span data-x="concept-is-declarative-shadow-root">is declarative shadow root</span> property to true.</p></li>
108178108194

108179-
<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
108180-
<a href="https://dom.spec.whatwg.org/#dom-is-declarative-shadow-root">is declarative shadow root</a> property to true.</p></li>
108181-
108182-
<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>
108195+
<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>
108183108196

108184-
<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>
108197+
<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>
108185108198
</ol>
108186108199
</li>
108187108200

@@ -111675,7 +111688,8 @@ document.body.appendChild(text);
111675111688
<p>The following steps form the <!--en-GB--><dfn id="html-fragment-serialisation-algorithm"
111676111689
data-export="">HTML fragment serialization algorithm</dfn>. The algorithm takes as input a DOM
111677111690
<code>Element</code>, <code>Document</code>, or <code>DocumentFragment</code> referred to as
111678-
<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>
111691+
<var>the node</var>, a boolean referred to as <var>include shadow roots</var>, and a
111692+
sequence&lt;ShadowRoot> referred to as <var>closed shadow roots</var>, and returns a string.</p>
111679111693

111680111694
<p class="note">This algorithm serializes the <em>children</em> of the node being serialized, not
111681111695
the node itself.</p>
@@ -111848,39 +111862,36 @@ document.body.appendChild(text);
111848111862
true, then:
111849111863

111850111864
<ol>
111851-
<li><p>Append the literal string "<code data-x="">&lt;template shadowroot=&quot;</code>" (U+003C LESS-THAN SIGN,
111852-
U+0074 LATIN SMALL LETTER T, U+0065 LATIN SMALL LETTER E, U+006D LATIN SMALL LETTER M,
111853-
U+0070 LATIN SMALL LETTER P, U+006C LATIN SMALL LETTER L, U+0061 LATIN SMALL LETTER A,
111854-
U+0074 LATIN SMALL LETTER T, U+0065 LATIN SMALL LETTER E, U+0020 SPACE,
111855-
U+0073 LATIN SMALL LETTER S, U+0068 LATIN SMALL LETTER H, U+0061 LATIN SMALL LETTER A,
111856-
U+0064 LATIN SMALL LETTER D, U+006F LATIN SMALL LETTER O, U+0077 LATIN SMALL LETTER W,
111857-
U+003D EQUALS SIGN, U+0022 QUOTATION MARK).</p></li>
111858-
111859-
<li><p>If <var>shadow root</var>'s <a href="https://dom.spec.whatwg.org/#shadowroot-mode">mode</a>
111860-
is "open", then append the literal
111861-
string "<code data-x="">open</code>" (U+006F LATIN SMALL LETTER O, U+0070 LATIN SMALL LETTER P,
111862-
U+0065 LATIN SMALL LETTER E, U+006E LATIN SMALL LETTER N).</p></li>
111863-
111864-
<li><p>If <var>shadow root</var>'s <a href="https://dom.spec.whatwg.org/#shadowroot-mode">mode</a>
111865-
is "closed", then append the literal
111866-
string "<code data-x="">closed</code>" (U+0063 LATIN SMALL LETTER C, U+006C LATIN SMALL LETTER L,
111867-
U+006F LATIN SMALL LETTER O, U+0073 LATIN SMALL LETTER S, U+0065 LATIN SMALL LETTER E,
111868-
U+0064 LATIN SMALL LETTER D).</p></li>
111869-
111870-
<li><p>Append the literal string "<code data-x="">&quot;&gt;</code>" (U+0022 QUOTATION MARK,
111871-
U+003E GREATER-THAN SIGN).</p></li>
111872-
111873-
<li><p>Append the value of running the <span>HTML fragment serialization algorithm</span> on the
111874-
<var>shadow root</var> element (thus recursing into this algorithm for that
111875-
element).</p></li>
111876-
111877-
<li><p>Append the literal string "<code data-x="">&lt;/template&gt;</code>" (U+003C LESS-THAN SIGN, U+002F SOLIDUS,
111878-
U+0074 LATIN SMALL LETTER T, U+0065 LATIN SMALL LETTER E, U+006D LATIN SMALL LETTER M,
111879-
U+0070 LATIN SMALL LETTER P, U+006C LATIN SMALL LETTER L, U+0061 LATIN SMALL LETTER A,
111880-
U+0074 LATIN SMALL LETTER T, U+0065 LATIN SMALL LETTER E, U+003E GREATER-THAN SIGN).</p></li>
111865+
<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>.
111866+
111867+
<li><p>If <var>shadow root</var>'s <span data-x="concept-shadow-root-mode">mode</span>
111868+
is "closed", and <var>shadow root</var> is <b>not</b> contained in <var>closed shadow roots</var>,
111869+
then skip the next step.
111881111870

111871+
<li><p>Otherwise:
111872+
111873+
<ol>
111874+
<li><p>Append the literal string "<code data-x="">&lt;template shadowroot=&quot;</code>".</p></li>
111875+
111876+
<li><p>If <var>shadow root</var>'s <span data-x="concept-shadow-root-mode">mode</span>
111877+
is "open", then append the literal
111878+
string "<code data-x="">open</code>".</p></li>
111879+
111880+
<li><p>If <var>shadow root</var>'s <span data-x="concept-shadow-root-mode">mode</span>
111881+
is "closed", then append the literal
111882+
string "<code data-x="">closed</code>".</p></li>
111883+
111884+
<li><p>Append the literal string "<code data-x="">&quot;&gt;</code>".</p></li>
111885+
111886+
<li><p>Append the value of running the <span>HTML fragment serialization algorithm</span> on the
111887+
<var>shadow root</var> <code>DocumentFragment</code> (thus recursing into this algorithm for that
111888+
element).</p></li>
111889+
111890+
<li><p>Append the literal string "<code data-x="">&lt;/template&gt;</code>".</p></li>
111891+
111892+
</ol>
111882111893
</ol>
111883-
</li>
111894+
</li>
111884111895

111885111896
<li><p>Return <var>s</var>.</p></li>
111886111897
</ol>

0 commit comments

Comments
 (0)