From 0879494e67a278e122fbb5d153fe9bdc156cab88 Mon Sep 17 00:00:00 2001 From: 0neGal Date: Tue, 22 Mar 2022 19:49:01 +0100 Subject: fixed potential edge case If a mod has the name of an already existing element some issues may arise... So now we have all mod elements prefixed with "mod-" and we also only search for elements inside #browserEntries, that should avoid all issues... --- src/app/browser.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/browser.js b/src/app/browser.js index 275e16e..8a8c6e4 100644 --- a/src/app/browser.js +++ b/src/app/browser.js @@ -70,15 +70,15 @@ var Browser = { }, setbutton: (mod, string) => { mod = normalize(mod); - if (document.getElementById(mod)) { - let elems = document.querySelectorAll(`#${mod}`); + if (browserEntries.querySelector(`#mod-${mod}`)) { + let elems = browserEntries.querySelectorAll(`.el#mod-${mod}`); for (let i = 0; i < elems.length; i++) { elems[i].querySelector(".text button").innerHTML = string; } } else { let make = (str) => { - if (document.getElementById(str)) { + if (browserEntries.querySelector(`#mod-${str}`)) { return Browser.setbutton(str, string); } else { return false; @@ -170,7 +170,7 @@ function BrowserEl(properties) { } browserEntries.innerHTML += ` -
+
-- cgit v1.2.3