The is
global attribute allows you to specify that a standard HTML element should behave like a defined custom built-in element (see Using custom elements for more details).
This attribute can only be used if the specified custom element name has been successfully defined in the current document, and extends the element type it is being applied to.
Examples
The following code is taken from our word-count-web-component example (see it live also).
class WordCount extends HTMLParagraphElement {
constructor() {
super();
}
}
customElements.define("word-count", WordCount, { extends: "p" });
Specifications
Browser compatibility
|
Desktop |
Mobile |
|
Chrome |
Edge |
Firefox |
Internet Explorer |
Opera |
Safari |
WebView Android |
Chrome Android |
Firefox for Android |
Opera Android |
Safari on IOS |
Samsung Internet |
is |
67 |
79 |
63 |
No |
54 |
No |
67 |
67 |
63 |
48 |
No |
9.0 |
See also