From 326a17f4e1f11df49ae8e88da9293a1fd4b1f31b Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Mon, 16 Aug 2021 18:03:43 +0200 Subject: [PATCH] Improve skooma attribute handling --- skooma.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/skooma.js b/skooma.js index 6ca6fbf..b8ab540 100644 --- a/skooma.js +++ b/skooma.js @@ -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])) }