Custom Elements
suggest changeSyntax
- .prototype.createdCallback()
- .prototype.attachedCallback()
- .prototype.detachedCallback()
- .prototype.attributeChangedCallback(name, oldValue, newValue)
- document.registerElement(name, [options])
Parameters
| Parameter | Details |
|---|---|
| name | The name of the new custom element. |
| options.extends | The name of the native element being extended, if any. |
| options.prototype | The custom prototype to use for the custom element, if any. |
Remarks
The syntax above is the obsolete v0 API (document.registerElement and createdCallback). The standardized API is customElements.define, with connectedCallback, disconnectedCallback, adoptedCallback, and attributeChangedCallback.
Custom elements let you define HTML tags in JavaScript, with associated styles and behavior. They are often used with Shadow DOM.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents