Web APIs
CustomElementRegistry.prototype.define()
Registers a valid custom element name and its constructor in the registry.
Formal Syntax & Structure
javascript syntaxjavascript
customElements.define(name, constructor)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| name | string | Valid custom element name. |
| constructor | Function | Custom element constructor. |
Return Value
undefined
Registers a valid custom element name and its constructor in the registry.
Working Example
Example Snippetjavascript
(async () => {class LessonStatus extends HTMLElement{};customElements.define("lesson-status",LessonStatus);const el=document.createElement("lesson-status");console.log(el instanceof LessonStatus);})()