]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Guard more in color-modes.js (#38235)
authorXhmikosR <xhmikosr@gmail.com>
Tue, 14 Mar 2023 18:30:11 +0000 (20:30 +0200)
committerGitHub <noreply@github.com>
Tue, 14 Mar 2023 18:30:11 +0000 (20:30 +0200)
site/static/docs/5.3/assets/js/color-modes.js

index 4528ba36b846ef68ee4b6af8460064b9f286f78a..541fcc21b537fa5a79294522ced598dc62122b74 100644 (file)
 
   const showActiveTheme = (theme, focus = false) => {
     const themeSwitcher = document.querySelector('#bd-theme')
+    const themeSwitcherText = document.querySelector('#bd-theme-text')
 
-    if (!themeSwitcher) {
+    if (!themeSwitcher || !themeSwitcherText) {
       return
     }
 
-    const themeSwitcherText = document.querySelector('#bd-theme-text')
     const activeThemeIcon = document.querySelector('.theme-icon-active use')
     const btnToActive = document.querySelector(`[data-bs-theme-value="${theme}"]`)
     const svgOfActiveBtn = btnToActive.querySelector('svg use').getAttribute('href')