From 43ddf739351fbbae1ccb9a5ab8a6e3fde07bdab6 Mon Sep 17 00:00:00 2001
From: Greg Fodor <gfodor@gmail.com>
Date: Tue, 6 Mar 2018 13:33:22 -0800
Subject: [PATCH] Use for of

---
 src/elements/a-gltf-entity.js | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/elements/a-gltf-entity.js b/src/elements/a-gltf-entity.js
index 005713f93..9e3ed0f61 100644
--- a/src/elements/a-gltf-entity.js
+++ b/src/elements/a-gltf-entity.js
@@ -95,17 +95,15 @@ function attachTemplate(templateEl) {
   const templateRoot = clone.firstElementChild;
   const templateRootAttrs = templateRoot.attributes;
 
-  for (let i = 0; i < targetEls.length; i++) {
-    const targetEl = targetEls[i];
-
+  for (const targetEl of targetEls) {
     // Merge root element attributes with the target element
-    for (let j = 0; j < templateRootAttrs.length; j++) {
-      targetEl.setAttribute(templateRootAttrs[j].name, templateRootAttrs[j].value);
+    for (const { name, value } of templateRootAttrs) {
+      targetEl.setAttribute(name, value);
     }
 
     // Append all child elements
-    for (let j = 0; j < templateRoot.children.length; j++) {
-      targetEl.appendChild(document.importNode(templateRoot.children[j], true));
+    for (const child of templateRoot.children) {
+      targetEl.appendChild(document.importNode(child, true));
     }
   }
 }
-- 
GitLab