From 439acaff903c8f7d15f836c2b939eb48685a9598 Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Sun, 28 Jul 2024 15:26:02 +0200 Subject: [PATCH] Make DOMObserver.onPrint handle old-style media query listener args FIX: Fix a crash on old Safari browsers that don't support `MediaQueryList.addEventListener`. Closes https://github.com/codemirror/view/pull/67 --- src/domobserver.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/domobserver.ts b/src/domobserver.ts index fb262c0..0c956a1 100644 --- a/src/domobserver.ts +++ b/src/domobserver.ts @@ -151,7 +151,7 @@ export class DOMObserver { } onPrint(event: Event) { - if (event.type == "change" && !(event as MediaQueryListEvent).matches) return + if ((event.type == "change" || !event.type) && !(event as MediaQueryListEvent).matches) return this.view.viewState.printing = true this.view.measure() setTimeout(() => {