MENU
Custom Elements
These are a set of JavaScript APIs that allow you to define custom elements and their behavior, which can then be used as desired in your user interface.
class WordCount extends HTMLParagraphElement {
constructor() {
// Always call super first in constructor
super();
// Element functionality written in here
...
}
}
customElements.define('word-count', WordCount, { extends: 'p' });
// Usage: <p is="word-count">...</p>