<span>표준 요소</span>
<red-span>비표준 요소</red-span>
class RedSpan extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
span {
color: red;
}
</style>
<span>
<slot/>
</span>
`;
}
}
customElements.define('red-span', RedSpan);
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.