Example 1 — Example
Typical usage.
JavaScript
console.log(typeof customElements);
console.log("customElements.define('my-el', class extends HTMLElement {})");How It Works
- define. Register a tag name.
- HTMLElement. Extend for behavior.
Custom Elements let you define new HTML tags with JavaScript classes via customElements.define.
console.log(typeof customElements);
console.log("customElements.define('my-el', class extends HTMLElement {})");Typical usage.
console.log(typeof customElements);
console.log("customElements.define('my-el', class extends HTMLElement {})");Check support.
console.log("Custom Elements — verify browser/Node support");CODETOFUN NEWS
Get the latest IT news, programming updates, and technology trends directly on your phone.
Your daily dose of tech, straight to your feed.
6 people found this page helpful