Limited availability
The get()
method of the CustomElementRegistry
interface returns the constructor for a previously-defined custom element.
name
The name of the custom element.
The constructor for the named custom element, or undefined
if there is no custom element defined with the name.
customElements.define(
"my-paragraph",
class 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));
}
},
);
// Return a reference to the my-paragraph constructor
let ctor = customElements.get("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