I have seen it a lot here and there, yet I could find any description or documentation about it!
Example:
The is
keyword is part of the W3C Draft spec for creating custom HTML elements with custom behavior.
In specific, You'd add the button to the page like this: Before you do this, you need to register This references a It'd be great if you could say If you are NOT extending a built-in HTML element like This is part of the W3C Draft spec for Web Components' Custom Elements:
http://www.w3.org/TR/custom-elements/#type-extension-semanticsis
is used when extending a built-in element like ,
or
. For example, you could have a
plastic-button
element that extends to provide some fancy animation when clicked.
plastic-button
as a custom HTML element like this:customElements.define("plastic-button", PlasticButton, { extends: "button" });
PlasticButton
Javascript class, which would look something like this: class PlasticButton extends HTMLButtonElement {
constructor() {
super();
this.addEventListener("click", () => {
// Draw some fancy animation effects!
});
}
}
instead of , but that would create an HTMLElement with no special behavior.
and instead creating a new element that extends the generic HTMLElement, you can use the
syntax. But you won't get any of 's behavior.