diff --git a/src/elements/a-gltf-entity.js b/src/elements/a-gltf-entity.js index 9e3ed0f61f370c35b7aa1fc6a3d7428b9bd7df88..ee59e3a24ead224a4095c69c70d2ea0da1c9cbd5 100644 --- a/src/elements/a-gltf-entity.js +++ b/src/elements/a-gltf-entity.js @@ -93,17 +93,16 @@ function attachTemplate(templateEl) { const targetEls = templateEl.parentNode.querySelectorAll(selector); const clone = document.importNode(templateEl.content, true); const templateRoot = clone.firstElementChild; - const templateRootAttrs = templateRoot.attributes; - for (const targetEl of targetEls) { + for (const el of targetEls) { // Merge root element attributes with the target element - for (const { name, value } of templateRootAttrs) { - targetEl.setAttribute(name, value); + for (const { name, value } of templateRoot.attributes) { + el.setAttribute(name, value); } // Append all child elements for (const child of templateRoot.children) { - targetEl.appendChild(document.importNode(child, true)); + el.appendChild(document.importNode(child, true)); } } }