From e89ef2ae1048ea273114c88bd0674300c914d0db Mon Sep 17 00:00:00 2001 From: hppeng Date: Wed, 3 Aug 2022 11:09:54 -0700 Subject: [PATCH] HOTFIX: style assignment via dictionary works correctly now.... how did we never notice this before --- js/utils.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/js/utils.js b/js/utils.js index c7b2a3e..c8b751c 100644 --- a/js/utils.js +++ b/js/utils.js @@ -874,6 +874,17 @@ function make_elem(type, classlist = [], args = {}) { const ret_elem = document.createElement(type); ret_elem.classList.add(...classlist); 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]; } return ret_elem;