Web APIs
CustomElementRegistry.get()
Look up the constructor registered for a custom element name; unknown names return undefined. Example console output: true true.
Formal Syntax & Structure
javascript syntaxjavascript
customElements.get(name)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| name | string | Custom element name. |
Return Value
CustomElementConstructor or undefined
Registered constructor if any.
Working Example
Example Snippetjavascript
class LessonBadge extends HTMLElement{} customElements.define("lesson-badge",LessonBadge); console.log(customElements.get("lesson-badge")===LessonBadge,customElements.get("lesson-unknown")===undefined);