The homepage has no #content, so elem would be null and an error would be thrown without this check.
This commit is contained in:
parent
ebd2774eab
commit
d3fc74e9ee
@ -3,7 +3,7 @@ function restoreDarkmode() {
|
||||
const elem = document.getElementById("content");
|
||||
|
||||
if (!document.cookie.includes("dark-mode=")) {
|
||||
if (prefersDarkMode.matches) {
|
||||
if (elem && prefersDarkMode.matches) {
|
||||
elem.classList.add("dark-mode");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user