Add special case for dataset to skooma templating

This commit is contained in:
Talia 2021-09-13 14:14:42 +02:00
parent bf50ea22dc
commit 12edc1890e

View file

@ -50,6 +50,9 @@ const parseArgs = (element, before, ...args) => {
for (let key in arg) for (let key in arg)
if (key == "style" && typeof(arg[key])=="object") if (key == "style" && typeof(arg[key])=="object")
insertStyles(element.style, arg[key]) insertStyles(element.style, arg[key])
else if (key == "dataset" && typeof(arg[key])=="object")
for (let [key2, value] of Object.entries(arg[key]))
element.dataset[key2] = parseAttribute(value)
else if (key == "shadowRoot") else if (key == "shadowRoot")
parseArgs((element.shadowRoot || element.attachShadow({mode: "open"})), null, arg[key]) parseArgs((element.shadowRoot || element.attachShadow({mode: "open"})), null, arg[key])
else if (typeof arg[key] === "function") else if (typeof arg[key] === "function")