Skip to content

Commit

Permalink
Make DOMObserver.onPrint handle old-style media query listener args
Browse files Browse the repository at this point in the history
FIX: Fix a crash on old Safari browsers that don't support
`MediaQueryList.addEventListener`.

Closes #67
  • Loading branch information
marijnh committed Jul 28, 2024
1 parent 59c56cc commit 439acaf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/domobserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down

0 comments on commit 439acaf

Please sign in to comment.