@@ -30,12 +30,10 @@ try {
3030 */
3131@Injectable ( { providedIn : 'root' } )
3232export class Platform {
33- /**
34- * Whether the Angular application is being rendered in the browser.
35- * We want to use the Angular platform check because if the Document is shimmed
36- * without the navigator, the following checks will fail. This is preferred because
37- * sometimes the Document may be shimmed without the user's knowledge or intention
38- */
33+ // We want to use the Angular platform check because if the Document is shimmed
34+ // without the navigator, the following checks will fail. This is preferred because
35+ // sometimes the Document may be shimmed without the user's knowledge or intention
36+ /** Whether the Angular application is being rendered in the browser. */
3937 isBrowser : boolean = this . _platformId ?
4038 isPlatformBrowser ( this . _platformId ) : typeof document === 'object' && ! ! document ;
4139
@@ -45,42 +43,41 @@ export class Platform {
4543 /** Whether the current rendering engine is Microsoft Trident. */
4644 TRIDENT : boolean = this . isBrowser && / ( m s i e | t r i d e n t ) / i. test ( navigator . userAgent ) ;
4745
48- /** Whether the current rendering engine is Blink. */
4946 // EdgeHTML and Trident mock Blink specific things and need to be excluded from this check.
47+ /** Whether the current rendering engine is Blink. */
5048 BLINK : boolean = this . isBrowser && ( ! ! ( ( window as any ) . chrome || hasV8BreakIterator ) &&
5149 typeof CSS !== 'undefined' && ! this . EDGE && ! this . TRIDENT ) ;
5250
53- /** Whether the current rendering engine is WebKit. */
5451 // Webkit is part of the userAgent in EdgeHTML, Blink and Trident. Therefore we need to
5552 // ensure that Webkit runs standalone and is not used as another engine's base.
53+ /** Whether the current rendering engine is WebKit. */
5654 WEBKIT : boolean = this . isBrowser &&
5755 / A p p l e W e b K i t / i. test ( navigator . userAgent ) && ! this . BLINK && ! this . EDGE && ! this . TRIDENT ;
5856
5957 /** Whether the current platform is Apple iOS. */
6058 IOS : boolean = this . isBrowser && / i P a d | i P h o n e | i P o d / . test ( navigator . userAgent ) &&
6159 ! ( 'MSStream' in window ) ;
6260
63- /** Whether the current browser is Firefox. */
6461 // It's difficult to detect the plain Gecko engine, because most of the browsers identify
6562 // them self as Gecko-like browsers and modify the userAgent's according to that.
6663 // Since we only cover one explicit Firefox case, we can simply check for Firefox
6764 // instead of having an unstable check for Gecko.
65+ /** Whether the current browser is Firefox. */
6866 FIREFOX : boolean = this . isBrowser && / ( f i r e f o x | m i n e f i e l d ) / i. test ( navigator . userAgent ) ;
6967
7068 /** Whether the current platform is Android. */
7169 // Trident on mobile adds the android platform to the userAgent to trick detections.
7270 ANDROID : boolean = this . isBrowser && / a n d r o i d / i. test ( navigator . userAgent ) && ! this . TRIDENT ;
7371
74- /** Whether the current browser is Safari. */
7572 // Safari browsers will include the Safari keyword in their userAgent. Some browsers may fake
7673 // this and just place the Safari keyword in the userAgent. To be more safe about Safari every
7774 // Safari browser should also use Webkit as its layout engine.
75+ /** Whether the current browser is Safari. */
7876 SAFARI : boolean = this . isBrowser && / s a f a r i / i. test ( navigator . userAgent ) && this . WEBKIT ;
7977
8078 /**
8179 * @breaking -change 8.0.0 remove optional decorator
8280 */
83- constructor ( @Optional ( ) @Inject ( PLATFORM_ID ) private _platformId ?: Object ) {
84- }
81+ constructor ( @Optional ( ) @Inject ( PLATFORM_ID ) private _platformId ?: Object ) { }
8582}
8683
0 commit comments