Skip to content

Commit

Permalink
revert function cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-bc-dev committed Jul 28, 2022
1 parent afda2c2 commit 363d9dd
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/js/utils/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,20 @@ 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') {
el[propName] = val;
}
});

Object.entries(attributes).forEach(([attrName, val]) => {
el.setAttribute(attrName, val);
Object.getOwnPropertyNames(attributes).forEach(function(attrName) {
el.setAttribute(attrName, attributes[attrName]);
});

if (content) {
Expand Down

0 comments on commit 363d9dd

Please sign in to comment.