@@ -14,25 +14,27 @@ export class Platform {
1414 isBrowser : boolean = typeof document === 'object' && ! ! document ;
1515
1616 /** Layout Engines */
17- EDGE = / ( e d g e ) / i. test ( navigator . userAgent ) ;
18- TRIDENT = / ( m s i e | t r i d e n t ) / i. test ( navigator . userAgent ) ;
17+ EDGE = this . isBrowser && / ( e d g e ) / i. test ( navigator . userAgent ) ;
18+ TRIDENT = this . isBrowser && / ( m s i e | t r i d e n t ) / i. test ( navigator . userAgent ) ;
1919
2020 // EdgeHTML and Trident mock Blink specific things and need to be excluded from this check.
21- BLINK = ! ! ( ( window as any ) . chrome || hasV8BreakIterator ) && ! ! CSS && ! this . EDGE && ! this . TRIDENT ;
21+ BLINK = this . isBrowser &&
22+ ( ! ! ( ( window as any ) . chrome || hasV8BreakIterator ) && ! ! CSS && ! this . EDGE && ! this . TRIDENT ) ;
2223
2324 // Webkit is part of the userAgent in EdgeHTML, Blink and Trident. Therefore we need to
2425 // ensure that Webkit runs standalone and is not used as another engine's base.
25- WEBKIT = / A p p l e W e b K i t / i. test ( navigator . userAgent ) && ! this . BLINK && ! this . EDGE && ! this . TRIDENT ;
26+ WEBKIT = this . isBrowser &&
27+ / A p p l e W e b K i t / i. test ( navigator . userAgent ) && ! this . BLINK && ! this . EDGE && ! this . TRIDENT ;
2628
2729 /** Browsers and Platform Types */
28- IOS = / i P a d | i P h o n e | i P o d / . test ( navigator . userAgent ) && ! ( window as any ) . MSStream ;
30+ IOS = this . isBrowser && / i P a d | i P h o n e | i P o d / . test ( navigator . userAgent ) && ! ( window as any ) . MSStream ;
2931
3032 // It's difficult to detect the plain Gecko engine, because most of the browsers identify
3133 // them self as Gecko-like browsers and modify the userAgent's according to that.
3234 // Since we only cover one explicit Firefox case, we can simply check for Firefox
3335 // instead of having an unstable check for Gecko.
34- FIREFOX = / ( f i r e f o x | m i n e f i e l d ) / i. test ( navigator . userAgent ) ;
36+ FIREFOX = this . isBrowser && / ( f i r e f o x | m i n e f i e l d ) / i. test ( navigator . userAgent ) ;
3537
3638 // Trident on mobile adds the android platform to the userAgent to trick detections.
37- ANDROID = / a n d r o i d / i. test ( navigator . userAgent ) && ! this . TRIDENT ;
39+ ANDROID = this . isBrowser && / a n d r o i d / i. test ( navigator . userAgent ) && ! this . TRIDENT ;
3840}
0 commit comments