From 25af9cfbea43272ebbb3abf6fc133b837c1b1baf Mon Sep 17 00:00:00 2001 From: WynieCronje Date: Wed, 27 Jan 2021 16:13:18 +0200 Subject: [PATCH 1/2] fix(browser-detection): fix isFirefox check --- projects/cdk/utils/browser/is-firefox.ts | 2 +- projects/cdk/utils/browser/test/browsers.spec.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/cdk/utils/browser/is-firefox.ts b/projects/cdk/utils/browser/is-firefox.ts index e9933632c7ea..6817be172017 100644 --- a/projects/cdk/utils/browser/is-firefox.ts +++ b/projects/cdk/utils/browser/is-firefox.ts @@ -1,3 +1,3 @@ export function isFirefox(userAgent: string): boolean { - return userAgent.includes('firefox'); + return userAgent.toLowerCase().includes('firefox'); } diff --git a/projects/cdk/utils/browser/test/browsers.spec.ts b/projects/cdk/utils/browser/test/browsers.spec.ts index 097439c27a64..1fc41c05a114 100644 --- a/projects/cdk/utils/browser/test/browsers.spec.ts +++ b/projects/cdk/utils/browser/test/browsers.spec.ts @@ -14,6 +14,7 @@ describe('Browsers', () => { it('isFirefox', () => { expect(isFirefox('firefox')).toBe(true); + expect(isFirefox('Firefox')).toBe(true); }); it('isEdgeOlderThan', () => { From e399a04bd124acc6aec06bc41e02fafa68b29e7e Mon Sep 17 00:00:00 2001 From: WynieCronje Date: Wed, 27 Jan 2021 16:36:44 +0200 Subject: [PATCH 2/2] fix(cdk): userAgent case sensitive checks --- projects/cdk/utils/browser/is-IE.ts | 2 +- projects/cdk/utils/browser/is-edge-older-than.ts | 2 +- projects/cdk/utils/browser/is-edge.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/cdk/utils/browser/is-IE.ts b/projects/cdk/utils/browser/is-IE.ts index 338610472ae4..d6b759cdbf9c 100644 --- a/projects/cdk/utils/browser/is-IE.ts +++ b/projects/cdk/utils/browser/is-IE.ts @@ -1,3 +1,3 @@ export function isIE(userAgent: string): boolean { - return userAgent.includes('trident'); + return userAgent.toLowerCase().includes('trident'); } diff --git a/projects/cdk/utils/browser/is-edge-older-than.ts b/projects/cdk/utils/browser/is-edge-older-than.ts index ba51b2664313..5933ff3354bd 100644 --- a/projects/cdk/utils/browser/is-edge-older-than.ts +++ b/projects/cdk/utils/browser/is-edge-older-than.ts @@ -1,7 +1,7 @@ export function isEdgeOlderThan(version: number, userAgent: string): boolean { const EDGE = 'edge/'; const currentVersion = parseInt( - userAgent.slice(userAgent.indexOf(EDGE) + EDGE.length), + userAgent.slice(userAgent.toLowerCase().indexOf(EDGE) + EDGE.length), 10, ); diff --git a/projects/cdk/utils/browser/is-edge.ts b/projects/cdk/utils/browser/is-edge.ts index ad5aa6df8537..efad0877884d 100644 --- a/projects/cdk/utils/browser/is-edge.ts +++ b/projects/cdk/utils/browser/is-edge.ts @@ -1,3 +1,3 @@ export function isEdge(userAgent: string): boolean { - return userAgent.includes('edge'); + return userAgent.toLowerCase().includes('edge'); }