Skip to content

Commit 474bf2a

Browse files
authored
Guard more in color-modes.js (#38235)
1 parent 6a043d9 commit 474bf2a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

site/static/docs/5.3/assets/js/color-modes.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929

3030
const showActiveTheme = (theme, focus = false) => {
3131
const themeSwitcher = document.querySelector('#bd-theme')
32+
const themeSwitcherText = document.querySelector('#bd-theme-text')
3233

33-
if (!themeSwitcher) {
34+
if (!themeSwitcher || !themeSwitcherText) {
3435
return
3536
}
3637

37-
const themeSwitcherText = document.querySelector('#bd-theme-text')
3838
const activeThemeIcon = document.querySelector('.theme-icon-active use')
3939
const btnToActive = document.querySelector(`[data-bs-theme-value="${theme}"]`)
4040
const svgOfActiveBtn = btnToActive.querySelector('svg use').getAttribute('href')

0 commit comments

Comments
 (0)