Skip to content

Commit 032ac69

Browse files
authored
Refactor theme toggle logic for body class
1 parent 5bbe4ad commit 032ac69

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

docs/js/theme-toggle.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@
2222
}
2323
const isDark = theme === 'dark';
2424
document.documentElement.classList.toggle(CODE_THEME_CLASS, isDark);
25-
if (document.body) {
26-
document.body.classList.toggle(CODE_THEME_CLASS, isDark);
27-
}
25+
document.body.classList.toggle(CODE_THEME_CLASS, isDark);
2826
}
2927

3028
const theme = localStorage.getItem(STORAGE_KEY) || (prefersDarkQuery?.matches ? 'dark' : 'light');

0 commit comments

Comments
 (0)