is
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Note: Safari does not plan to support custom built-in elements and browser vendors are exploring alternative solutions to customizing built-ins. Check the browser compatibility section for support information.
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).
// Create a class for the element
class WordCount extends HTMLParagraphElement {
constructor() {
// Always call super first in constructor
super();
// Constructor contents omitted for brevity
// …
}
}
// Define the new element
customElements.define("word-count", WordCount, { extends: "p" });
<p is="word-count"></p>
Specifications
Specification |
---|
HTML # attr-is |
Browser compatibility
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
is |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- See implementation notes.
See also
- All global attributes.