Fix: iOS 12.2 incompatible script (#19029)
This commit is contained in:
parent
8e521ca653
commit
9869149cf0
2 changed files with 6 additions and 2 deletions
|
|
@ -65,7 +65,9 @@ function updateCssColors() {
|
|||
|
||||
// update colors on theme change
|
||||
const darkModeMatcher = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)");
|
||||
darkModeMatcher?.addEventListener("change", updateCssColors);
|
||||
if (darkModeMatcher && darkModeMatcher.addEventListener) {
|
||||
darkModeMatcher.addEventListener("change", updateCssColors);
|
||||
}
|
||||
// initialize colors
|
||||
updateCssColors();
|
||||
window.requestAnimationFrame(updateCssColors);
|
||||
|
|
|
|||
|
|
@ -62,7 +62,9 @@ function updateMetaThemeForBackdrop() {
|
|||
}
|
||||
|
||||
export function watchThemeChanges() {
|
||||
darkModeMatcher?.addEventListener("change", updateTheme);
|
||||
if (darkModeMatcher && darkModeMatcher.addEventListener) {
|
||||
darkModeMatcher.addEventListener("change", updateTheme);
|
||||
}
|
||||
updateTheme();
|
||||
|
||||
// listen for modal backdrops
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue