HOTFIX: style assignment via dictionary works correctly now....
how did we never notice this before
This commit is contained in:
parent
f95d8c9d95
commit
e89ef2ae10
1 changed files with 11 additions and 0 deletions
11
js/utils.js
11
js/utils.js
|
@ -874,6 +874,17 @@ function make_elem(type, classlist = [], args = {}) {
|
||||||
const ret_elem = document.createElement(type);
|
const ret_elem = document.createElement(type);
|
||||||
ret_elem.classList.add(...classlist);
|
ret_elem.classList.add(...classlist);
|
||||||
for (const i in args) {
|
for (const i in args) {
|
||||||
|
if (i === 'style') {
|
||||||
|
const style_obj = args[i];
|
||||||
|
if (typeof style_obj === 'string' || style_obj instanceof String) {
|
||||||
|
ret_elem.style = style_obj;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (const k in style_obj) {
|
||||||
|
ret_elem.style[k] = style_obj[k];
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
ret_elem[i] = args[i];
|
ret_elem[i] = args[i];
|
||||||
}
|
}
|
||||||
return ret_elem;
|
return ret_elem;
|
||||||
|
|
Loading…
Reference in a new issue