From 4b1a9203c547c019fc5398082ae19a3f3d4c3efe Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:41:15 -0500 Subject: initial commit --- files/de/web/html/globale_attribute/is/index.html | 62 +++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 files/de/web/html/globale_attribute/is/index.html (limited to 'files/de/web/html/globale_attribute/is/index.html') diff --git a/files/de/web/html/globale_attribute/is/index.html b/files/de/web/html/globale_attribute/is/index.html new file mode 100644 index 0000000000..ff888d1002 --- /dev/null +++ b/files/de/web/html/globale_attribute/is/index.html @@ -0,0 +1,62 @@ +--- +title: is +slug: Web/HTML/Globale_Attribute/is +translation_of: Web/HTML/Global_attributes/is +--- +
{{HTMLSidebar("Global_attributes")}}
+ +

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 ommitted for brevity
+    ...
+
+  }
+}
+
+// Define the new element
+customElements.define('word-count', WordCount, { extends: 'p' });
+ +
<p is="word-count"></p>
+ +

Specifications

+ + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('HTML WHATWG', "custom-elements.html#attr-is", "is")}}{{Spec2('HTML WHATWG')}} 
+ +

Browser compatibility

+ + + +

{{Compat("html.global_attributes.is")}}

+ +

See also

+ + -- cgit v1.2.3-54-g00ecf