is

is 전역 특성은 표준 HTML 요소가 사용자 지정 요소처럼 행동하도록 지정합니다. 사용자 지정 요소 사용하기를 방문해 더 자세한 정보를 알아보세요.

이 특성은 주어진 사용자 지정 요소의 이름을 현재 문서에 성공적으로 정의 (en-US)했고, is 특성을 적용하려는 요소를 확장하는 경우에만 사용할 수 있습니다.

예제

다음 코드는 word-count-web-component 예제에서 발췌한 것입니다. (실제 동작 보기)

js
// 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' });
html
<p is="word-count"></p>

명세

Specification
HTML Standard
# attr-is

브라우저 호환성

BCD tables only load in the browser

같이 보기