Skip to content

Commit 4055a4c

Browse files
crisbetotinayuangao
authored andcommitted
fix(layout): handle platforms that don't support matchMedia (#8775)
Adds an extra check to ensure that the current platform supports `window.matchMedia`. Fixes #8710.
1 parent fce47c4 commit 4055a4c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/cdk/layout/media-matcher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class MediaMatcher {
2020
private _matchMedia: (query: string) => MediaQueryList;
2121

2222
constructor(private platform: Platform) {
23-
this._matchMedia = this.platform.isBrowser ?
23+
this._matchMedia = this.platform.isBrowser && window.matchMedia ?
2424
// matchMedia is bound to the window scope intentionally as it is an illegal invocation to
2525
// call it from a different scope.
2626
window.matchMedia.bind(window) :

0 commit comments

Comments
 (0)