Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
blob: b2465abc61977348ce6dcb07ee04bd1ed7768dc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
class SoldierRecordBlock extends HTMLDivElement {
  constructor() {
    super();

    let template = document.getElementById('soldier-record-block');
    let templateContent = template.content;

    const shadowRoot = this.attachShadow({ mode: "open" });
    shadowRoot.appendChild(templateContent.cloneNode(true));

    // console.log(shadowRoot)

    // this.shadowRoot
    //   .querySelectorAll('p:has(input[type="number"]), .physical-status-track')
    //   .forEach(el => el.addEventListener('click', e => e.stopPropagation()))
    //   ;
  }
}

customElements.define(
  'damage-block',
  class extends HTMLSpanElement {
    constructor() {
      super();

      let template = document.getElementById('damage-block');
      let templateContent = template.content;

      const shadowRoot = this.attachShadow({ mode: "open" });
      shadowRoot.appendChild(templateContent.cloneNode(true));
    }
  },
  { extends: 'span' }
);

customElements.define(
  'soldier-record-block',
  SoldierRecordBlock,
  { extends: 'div'}
);