Prevent default on skooma event listeners

This commit is contained in:
Talia 2021-06-24 15:58:11 +02:00
parent 9f78a9bf14
commit d670416c7a
Signed by: darkwiiplayer
GPG key ID: 7808674088232B3E

View file

@ -31,7 +31,7 @@ const parseArgs = (element, args) => {
else else
for (let key in arg) for (let key in arg)
if (typeof arg[key] == "function") if (typeof arg[key] == "function")
element.addEventListener(key.replace(/^on[A-Z]/, x => x.charAt(x.length-1).toLowerCase()), arg[key]) element.addEventListener(key.replace(/^on[A-Z]/, x => x.charAt(x.length-1).toLowerCase()), e => e.preventDefault() || arg[key](e))
else else
element.setAttribute(key, parseAttribute(arg[key])) element.setAttribute(key, parseAttribute(arg[key]))
} }