From 363d9dd6c05c8cd93b4e5fd3519e8d7a8af7f4f8 Mon Sep 17 00:00:00 2001 From: Roman Pougatchev Date: Thu, 28 Jul 2022 15:05:12 -0400 Subject: [PATCH] revert function cleanup --- src/js/utils/dom.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/js/utils/dom.js b/src/js/utils/dom.js index e7909da6d0..c6321ee0d2 100644 --- a/src/js/utils/dom.js +++ b/src/js/utils/dom.js @@ -150,7 +150,11 @@ function createQuerier(method) { export function createEl(tagName = 'div', properties = {}, attributes = {}, content) { const el = document.createElement(tagName); - Object.entries(properties).forEach(([propName, val]) => { + Object.getOwnPropertyNames(properties).forEach(function(propName) { + const val = properties[propName]; + + // Handle textContent since it's not supported everywhere and we have a + // method for it. if (propName === 'textContent') { textContent(el, val); } else if (el[propName] !== val || propName === 'tabIndex') { @@ -158,8 +162,8 @@ export function createEl(tagName = 'div', properties = {}, attributes = {}, cont } }); - Object.entries(attributes).forEach(([attrName, val]) => { - el.setAttribute(attrName, val); + Object.getOwnPropertyNames(attributes).forEach(function(attrName) { + el.setAttribute(attrName, attributes[attrName]); }); if (content) {