Prevent default on skooma event listeners

This commit is contained in:
Talia 2021-06-24 15:58:11 +02:00
parent 523a720196
commit 397d294f41

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]))
} }