From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/html/global_attributes%2Fis.html | 79 ++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 devdocs/html/global_attributes%2Fis.html (limited to 'devdocs/html/global_attributes%2Fis.html') diff --git a/devdocs/html/global_attributes%2Fis.html b/devdocs/html/global_attributes%2Fis.html new file mode 100644 index 00000000..dab03631 --- /dev/null +++ b/devdocs/html/global_attributes%2Fis.html @@ -0,0 +1,79 @@ +

is

+

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).

+

js

+
// 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" });
+
+
+

html

+
<p is="word-count"></p>
+
+
+
+

Specifications

+
+ + +
Specification
HTML Standard
# attr-is
+

Browser compatibility

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariWebView AndroidChrome AndroidFirefox for AndroidOpera AndroidSafari on IOSSamsung Internet
is677963No54No67676348No9.0
+

See also

+
+

+ © 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
+ https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/is +

+
-- cgit v1.2.3