diff --git a/js/toolbar.js b/js/toolbar.js index 55c16c0fb9..aa6314ce9e 100644 --- a/js/toolbar.js +++ b/js/toolbar.js @@ -617,16 +617,17 @@ class Toolbar { } renderThemeSelectIcon(themeBox, themes) { - const icon = document.getElementById("themeSelectIcon"); + const icon = docById("themeSelectIcon"); + if (!icon) return; + themes.forEach(theme => { if (localStorage.themePreference === theme) { - icon.innerHTML = document.getElementById(theme).innerHTML; + icon.innerHTML = docById(theme).innerHTML; } }); - const themeSelectIcon = docById("themeSelectIcon"); - const themeList = themes; - themeSelectIcon.onclick = () => { - themeList.forEach(theme => { + + icon.onclick = () => { + themes.forEach(theme => { docById(theme).onclick = () => themeBox[`${theme}_onclick`](this.activity); }); };