|
|
|
@ -39,15 +39,16 @@ class BoardGameComponent extends HTMLElement { |
|
|
|
|
for (const [slotName, templateName] of Object.entries(slotTemplateNames)) { |
|
|
|
|
this.querySelectorAll(`.${slotName}`).forEach((slot) => { |
|
|
|
|
if (slot.getAttribute("data-current-template") !== templateName) { |
|
|
|
|
while (slot.lastChild) { |
|
|
|
|
slot.removeChild(slot.lastChild); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const template = this.querySelector(`template[name="${templateName}"]`); |
|
|
|
|
if (template) { |
|
|
|
|
while (slot.lastChild) { |
|
|
|
|
slot.removeChild(slot.lastChild); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
slot.appendChild(template.content.cloneNode(true)); |
|
|
|
|
slot.setAttribute("data-current-template", templateName); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
slot.setAttribute("data-current-template", templateName); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|