From 9e60491e034fbd5558df94fa02ddb5c51c07cfa4 Mon Sep 17 00:00:00 2001 From: crisbeto Date: Thu, 15 Feb 2018 17:03:14 +0100 Subject: [PATCH] fix(platform): potential error if CSS object is undefined Fixes a potential error if the global `CSS` object is undefined. Fixes #9801. --- src/cdk/platform/platform.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cdk/platform/platform.ts b/src/cdk/platform/platform.ts index 81af1441020f..cf093747c7ef 100755 --- a/src/cdk/platform/platform.ts +++ b/src/cdk/platform/platform.ts @@ -10,7 +10,7 @@ import {Injectable} from '@angular/core'; // Whether the current platform supports the V8 Break Iterator. The V8 check // is necessary to detect all Blink based browsers. -const hasV8BreakIterator = (typeof(Intl) !== 'undefined' && (Intl as any).v8BreakIterator); +const hasV8BreakIterator = (typeof Intl !== 'undefined' && (Intl as any).v8BreakIterator); /** * Service to detect the current platform by comparing the userAgent strings and @@ -29,8 +29,8 @@ export class Platform { /** Whether the current rendering engine is Blink. */ // EdgeHTML and Trident mock Blink specific things and need to be excluded from this check. - BLINK: boolean = this.isBrowser && - (!!((window as any).chrome || hasV8BreakIterator) && !!CSS && !this.EDGE && !this.TRIDENT); + BLINK: boolean = this.isBrowser && (!!((window as any).chrome || hasV8BreakIterator) && + typeof CSS !== 'undefined' && !this.EDGE && !this.TRIDENT); /** Whether the current rendering engine is WebKit. */ // Webkit is part of the userAgent in EdgeHTML, Blink and Trident. Therefore we need to