Improve skooma attribute handling

This commit is contained in:
Talia 2021-08-16 18:03:43 +02:00
parent 8454f21c3a
commit 2ac1e0d4b8
Signed by: darkwiiplayer
GPG Key ID: 7808674088232B3E
1 changed files with 4 additions and 0 deletions

View File

@ -46,6 +46,10 @@ const parseArgs = (element, ...args) => {
parseArgs((element.shadowRoot || element.attachShadow({mode: "open"})), arg[key])
else if (typeof arg[key] == "function")
element.addEventListener(key.replace(/^on[A-Z]/, x => x.charAt(x.length-1).toLowerCase()), e => e.preventDefault() || arg[key](e))
else if (arg[key] === true)
{if (!element.hasAttribute(key)) element.setAttribute(key, '')}
else if (arg[key] === false)
element.removeAttribute(key)
else
element.setAttribute(key, parseAttribute(arg[key]))
}