From 0c45df84a6dab701e5a8e3eefd3d566ce3591737 Mon Sep 17 00:00:00 2001
From: Domenic Denicola
If definition's local + name is equal to definition's name (i.e., definition is for + an autonomous custom element), then:
+ +If the currently-executing constructor is not HTMLElement
, then throw a
+ TypeError
and abort these steps.
This can occur when a custom element is defined to not extend any local names, but
+ inherits from a non-HTMLElement
class:
customElements.define("bad-1", class Bad1 extends HTMLParagraphElement {});+ +
In this case, during the (implicit) super()
call that occurs when
+ constructing an instance of Bad1
, the currently-executing constructor
+ is HTMLParagraphElement
, not HTMLElement
.
Otherwise (i.e., if definition is for a customized built-in + element):
+ +Let valid local names be the list of local names for elements defined in this + specification or in other applicable specifications that use the active + function object as their element interface.
If valid local names does not contain definition's local name, then throw a
+ TypeError
and abort these steps.
This can occur when a custom element is defined to extend a given local name but inherits + from the wrong class:
+ +customElements.define("bad-2", class Bad2 extends HTMLQuoteElement {}, { extends: "p" });+ +
In this case, during the (implicit) super()
call that occurs when
+ constructing an instance of Bad2
, valid local names is the
+ list containing q
and blockquote
, but definition's local name is p
,
+ which is not in that list.
Let prototype be definition's prototype.