From 124857f7f8fb6313433deb58bdd810f926d266df Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Wed, 26 May 2021 11:26:44 +0200 Subject: [PATCH] Add event listeners to skooma.js --- skooma.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/skooma.js b/skooma.js index 164244f..81332bb 100644 --- a/skooma.js +++ b/skooma.js @@ -18,7 +18,10 @@ const parseArgs = (element, args) => { parseArgs(element, arg) else for (let key in arg) - element.setAttribute(key, parseAttribute(arg[key])) + if (typeof arg[key] == "function") + element.addEventListener(key.replace(/^on[A-Z]/, x => x.charAt(x.length-1).toLowerCase()), arg[key]) + else + element.setAttribute(key, parseAttribute(arg[key])) } const node = (name, args, xmlns) => {