minor updates for el function after habr.com feedback

This commit is contained in:
Денис Строков
2023-02-16 00:06:12 +03:00
parent 26f9927437
commit bc2926ce61
2 changed files with 6 additions and 12 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@webislife/wc-wysiwyg",
"version": "0.9.32",
"version": "0.9.33",
"description": "WYWSIWYG HTML5 Editor written in ts and designed by web-componennt, support all JS frameworks and browsers",
"main": "dist/wc-wysiwyg.js",
"type": "module",

View File

@ -1,5 +1,5 @@
/**
* Short
* Short for document.createElement
* @param tagName element tag name
* @param params list of object params for document.createElements
* @returns
@ -27,11 +27,7 @@
}
// element.style[prop]
if(styles) {
const stylesKeys = Object.keys(styles);
for (let i = 0; i < stylesKeys.length; i++) {
const key = stylesKeys[i];
element.style[key] = styles[key];
}
Object.assign(element.style, styles);
}
// element[prop]
if(props) {
@ -51,11 +47,9 @@
}
}
}
if(append) {
for (let i = 0; i < append.length; i++) {
const appendEl = append[i];
element.append(appendEl);
}
//append child elements
if(append.length) {
element.append(...append);
}
return element;
};