From bc73c885622d1383f8e6a1303738b8c3d94282cf Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sat, 29 Apr 2023 15:26:55 +0200 Subject: [PATCH] factorization --- static/js/libs/hljs.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/static/js/libs/hljs.js b/static/js/libs/hljs.js index 08b8004..eab12d7 100644 --- a/static/js/libs/hljs.js +++ b/static/js/libs/hljs.js @@ -21,7 +21,7 @@ window.addEventListener("load", () => { /* Theme */ const dark = "dark"; const light = "light"; - const attribute = ["disabled", "disabled"]; + const attribute = "disabled"; const updateTheme = (theme) => { { const elementToEnable = document.getElementById( @@ -31,10 +31,10 @@ window.addEventListener("load", () => { `hljs-${theme.matches ? light : dark}-theme` ); - if (elementToEnable.hasAttribute(attribute[0])) { - elementToEnable.removeAttribute(attribute[0]); + if (elementToEnable.hasAttribute(attribute)) { + elementToEnable.removeAttribute(attribute); } - elementToDisable.setAttribute(...attribute); + elementToDisable.setAttribute(attribute, attribute); } };