HOTFIX: style assignment via dictionary works correctly now....

how did we never notice this before
This commit is contained in:
hppeng 2022-08-03 11:09:54 -07:00
parent f95d8c9d95
commit e89ef2ae10

View file

@ -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;