Skip to content

Commit d8ee297

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

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/cdk/layout/media-matcher.ts

+1-1
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)