blob: 5e430b5f138324546805af7610f04c41c065f6a9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
customElements.define(
"z-component",
class extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' });
}
connectedCallback() {
const type = this.getAttribute('type');
const template = document.getElementById(`--${type}`);
const node = document.importNode(template.content, true);
this.shadowRoot.appendChild(node);
}
}
);
|