Improve skooma attribute handling
This commit is contained in:
parent
864cf22f5f
commit
326a17f4e1
1 changed files with 4 additions and 0 deletions
|
@ -46,6 +46,10 @@ const parseArgs = (element, ...args) => {
|
||||||
parseArgs((element.shadowRoot || element.attachShadow({mode: "open"})), arg[key])
|
parseArgs((element.shadowRoot || element.attachShadow({mode: "open"})), arg[key])
|
||||||
else if (typeof arg[key] == "function")
|
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))
|
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
|
else
|
||||||
element.setAttribute(key, parseAttribute(arg[key]))
|
element.setAttribute(key, parseAttribute(arg[key]))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue