Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b1b08e1

Browse files
authored
Make CustomElementConstructor exceptions more consistent
And allow for simplification of "create an element" by moving a step into IDL. Tests: web-platform-tests/wpt#16328. Corresponding DOM changes: whatwg/dom#751. Fixes whatwg#4520.
1 parent 8891139 commit b1b08e1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

source

+5-5
Original file line numberDiff line numberDiff line change
@@ -66820,7 +66820,7 @@ interface <dfn>CustomElementRegistry</dfn> {
6682066820
[<span>CEReactions</span>] void <span data-x="dom-CustomElementRegistry-upgrade">upgrade</span>(<span>Node</span> root);
6682166821
};
6682266822

66823-
callback <dfn>CustomElementConstructor</dfn> = any ();
66823+
callback <dfn>CustomElementConstructor</dfn> = <span>HTMLElement</span> ();
6682466824

6682566825
dictionary <dfn>ElementDefinitionOptions</dfn> {
6682666826
DOMString extends;
@@ -67227,13 +67227,13 @@ customElements.define("x-foo", class extends HTMLElement {
6722767227
</li>
6722867228

6722967229
<li>
67230-
<p>If <span>SameValue</span>(<var>constructResult</var>, <var>element</var>) is false,
67231-
then throw an <span>"<code>InvalidStateError</code>"</span> <code>DOMException</code>.</p>
67230+
<p>If <span>SameValue</span>(<var>constructResult</var>, <var>element</var>) is false, then
67231+
throw a <code>TypeError</code>.</p>
6723267232

6723367233
<p class="note">This can occur if <var>C</var> constructs another instance of the same custom
6723467234
element before calling <code data-x="">super()</code>, or if <var>C</var> uses JavaScript's
67235-
<code data-x="">return</code>-override feature to return an arbitrary object from the
67236-
constructor.</p>
67235+
<code data-x="">return</code>-override feature to return an arbitrary <code>HTMLElement</code>
67236+
object from the constructor.</p>
6723767237
</li>
6723867238
</ol>
6723967239

0 commit comments

Comments
 (0)