Skip to content

Commit

Permalink
fix(layout): handle platforms that don't support matchMedia (#8775)
Browse files Browse the repository at this point in the history
Adds an extra check to ensure that the current platform supports `window.matchMedia`.

Fixes #8710.
  • Loading branch information
crisbeto authored and jelbourn committed Jan 8, 2018
1 parent c0209fc commit 673a636
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cdk/layout/media-matcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class MediaMatcher {
private _matchMedia: (query: string) => MediaQueryList;

constructor(private platform: Platform) {
this._matchMedia = this.platform.isBrowser ?
this._matchMedia = this.platform.isBrowser && window.matchMedia ?
// matchMedia is bound to the window scope intentionally as it is an illegal invocation to
// call it from a different scope.
window.matchMedia.bind(window) :
Expand Down

0 comments on commit 673a636

Please sign in to comment.