is

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

is グローバル属性で、標準の HTML 要素が定義されたカスタム組み込み要素のように振る舞うよう指定することができます(詳しくはカスタム要素の使用を参照してください)。

この属性は、指定されたカスタム要素名が現在の文書で正常に定義され、適用されている要素型が拡張されている場合にのみ使用します。

次のコードは、 word-count-web-component の例から取得されたものです(ライブで参照)。

js
// 要素のクラスを作成
class WordCount extends HTMLParagraphElement {
  constructor() {
    // コンストラクターでは常に最初に super を呼び出すこと
    super();

    // コンストラクターの内容は簡略化のため除外しています
    // …
  }
}

// 新しい要素を定義
customElements.define("word-count", WordCount, { extends: "p" });
html
<p is="word-count"></p>

仕様書

Specification
HTML
# attr-is

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
is

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
See implementation notes.

関連情報