Skip to content

Commit 7b6cee0

Browse files
committed
use sanitized reference
1 parent 26af1d2 commit 7b6cee0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/theme/index.hbs

+2-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
<script>
6060
var path_to_root = "{{ path_to_root }}";
6161
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "{{ preferred_dark_theme }}" : "{{ default_theme }}";
62+
default_theme = default_theme.replace(/\W+/g, '_').toLowerCase();
6263
</script>
6364

6465
<!-- Work around some values being stored in localStorage wrapped in quotes -->
@@ -85,7 +86,7 @@
8586
var html = document.querySelector('html');
8687
html.classList.remove('no-js')
8788
try {
88-
html.classList.remove('{{ default_theme }}');
89+
html.classList.remove(default_theme);
8990
html.classList.add(theme.replace(/\W+/g, '_').toLowerCase());
9091
} catch(e) { }
9192
html.classList.add('js');

0 commit comments

Comments
 (0)