ATTRIBUTES

Editing
  • account_tree
  • bug_report

is

표준 HTML 요소를 사용자 정의 내장 요소처럼 작동하도록 지정한다. 

설명

사용자 정의 요소가 생성된 후 is 애트리뷰트의 값을 변경해도 is 값으로 요소에 저장되므로 요소의 동작이 변경되지 않는다.

구문

마크업 형식
<p is="custom-paragraph"></p>

다음의 자바스크립트 로직을 통해 is 애트리뷰트가 'custom'인 p 표준 요소를 사용자 정의 내장 요소로 사용할 수 있다.

class CustomParagraph extends HTMLParagraphElement {
  constructor() {
    super();
  }
}

customElements.define("custom-paragraph", CustomParagraph, { extends: "p" });

 

버전 명세

HTML Standard
#attr-is

지원 웹브라우저