Skip to content

Commit c512c95

Browse files
authored
Make upgrade an element throw more
In particular if folks disable support for ShadowRoot and ElementInternals, this will make upgrade an element throw a NotSupportedError so element constructors only run with expected state. Tests: web-platform-tests/wpt#17162.
1 parent 8125b06 commit c512c95

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

source

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3149,7 +3149,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
31493149
<li><dfn data-x-href="https://dom.spec.whatwg.org/#interface-documenttype"><code>DocumentType</code></dfn> interface</li>
31503150
<li><dfn data-x-href="https://dom.spec.whatwg.org/#interface-childnode"><code>ChildNode</code></dfn> interface</li>
31513151
<li><dfn data-x-href="https://dom.spec.whatwg.org/#interface-element"><code>Element</code></dfn> interface</li>
3152-
<li><dfn data-x="dom-element-attachshadow" data-x-href="https://dom.spec.whatwg.org/#dom-element-attachshadow"><code>attachShadow()</code></dfn> method.</li>
3152+
<li><dfn data-x="dom-Element-attachShadow" data-x-href="https://dom.spec.whatwg.org/#dom-element-attachshadow"><code>attachShadow()</code></dfn> method.</li>
3153+
<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>
31533154
<li><dfn data-x-href="https://dom.spec.whatwg.org/#interface-node"><code>Node</code></dfn> interface</li>
31543155
<li><dfn data-x-href="https://dom.spec.whatwg.org/#interface-nodelist"><code>NodeList</code></dfn> interface</li>
31553156
<li><dfn data-x-href="https://dom.spec.whatwg.org/#interface-processinginstruction"><code>ProcessingInstruction</code></dfn> interface</li>
@@ -67039,7 +67040,7 @@ document.body.append(parent);
6703967040

6704067041
<dt>A <dfn data-x="concept-custom-element-definition-disable-shadow" data-export=""
6704167042
data-dfn-for="custom element definition">disable shadow</dfn> boolean</dt>
67042-
<dd>Controls <code data-x="dom-element-attachshadow">attachShadow()</code>.
67043+
<dd>Controls <code data-x="dom-Element-attachShadow">attachShadow()</code>.
6704367044
</dl>
6704467045

6704567046
<p>To <dfn data-export="">look up a custom element definition</dfn>, given a <var>document</var>,
@@ -67544,6 +67545,19 @@ customElements.define("x-foo", class extends HTMLElement {
6754467545
<p>Run the following substeps while catching any exceptions:</p>
6754567546

6754667547
<ol>
67548+
<li>
67549+
<p>If <var>definition</var>'s <span
67550+
data-x="concept-custom-element-definition-disable-shadow">disable shadow</span> is true and
67551+
<var>element</var>'s <span data-x="concept-element-shadow-root">shadow root</span> is
67552+
non-null, then throw a <span>"<code>NotSupportedError</code>"</span>
67553+
<code>DOMException</code>.</p>
67554+
67555+
<p class="note">This is needed as <code
67556+
data-x="dom-Element-attachShadow">attachShadow()</code> does not use <span>look up a custom
67557+
element definition</span> while <code data-x="dom-attachInternals">attachInternals()</code>
67558+
does.</p>
67559+
</li>
67560+
6754767561
<li>
6754867562
<p>Let <var>constructResult</var> be the result of <span
6754967563
data-x="es-constructing-callback-functions">constructing</span> <var>C</var>, with no

0 commit comments

Comments
 (0)