Limited availability
The getName()
method of the CustomElementRegistry
interface returns the name for a previously-defined custom element.
constructor
Constructor for the custom element.
The name for the previously defined custom element, or null
if there is no custom element defined with the constructor.
class MyParagraph extends HTMLElement {
constructor() {
let templateContent = document.getElementById("custom-paragraph").content;
super() // returns element this scope
.attachShadow({ mode: "open" }) // sets AND returns this.shadowRoot
.append(templateContent.cloneNode(true));
}
}
customElements.define("my-paragraph", MyParagraph);
// Return a reference to the my-paragraph constructor
customElements.getName(MyParagraph) === "my-paragraph";
Specifications Browser compatibility
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3