From a15af2095e785d7583932a0339d8fc6dcc0523f6 Mon Sep 17 00:00:00 2001 From: minigt Date: Fri, 11 Aug 2023 00:49:22 -0300 Subject: [PATCH 1/2] Fix regex so moto edge doesn't mislead the browser(as edge) --- src/scripts/browser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scripts/browser.js b/src/scripts/browser.js index 47b0635d52..92137e2af9 100644 --- a/src/scripts/browser.js +++ b/src/scripts/browser.js @@ -187,13 +187,13 @@ function supportsCssAnimation(allowPrefix) { const uaMatch = function (ua) { ua = ua.toLowerCase(); - const match = /(edg)[ /]([\w.]+)/.exec(ua) + const match = /(chrome)[ /]([\w.]+)/.exec(ua) + || /(edg)[ /]([\w.]+)/.exec(ua) || /(edga)[ /]([\w.]+)/.exec(ua) || /(edgios)[ /]([\w.]+)/.exec(ua) || /(edge)[ /]([\w.]+)/.exec(ua) || /(opera)[ /]([\w.]+)/.exec(ua) || /(opr)[ /]([\w.]+)/.exec(ua) - || /(chrome)[ /]([\w.]+)/.exec(ua) || /(safari)[ /]([\w.]+)/.exec(ua) || /(firefox)[ /]([\w.]+)/.exec(ua) || ua.indexOf('compatible') < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) From 04c3afd9e5c0977a628d3d29b6fe1ce2b443d574 Mon Sep 17 00:00:00 2001 From: minigt Date: Fri, 18 Aug 2023 22:46:34 -0300 Subject: [PATCH 2/2] Fixed sonarcloud code smell --- src/scripts/browser.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/scripts/browser.js b/src/scripts/browser.js index 92137e2af9..15898f03b1 100644 --- a/src/scripts/browser.js +++ b/src/scripts/browser.js @@ -148,14 +148,11 @@ let _supportsCssAnimation; let _supportsCssAnimationWithPrefix; function supportsCssAnimation(allowPrefix) { // TODO: Assess if this is still needed, as all of our targets should natively support CSS animations. - if (allowPrefix) { - if (_supportsCssAnimationWithPrefix === true || _supportsCssAnimationWithPrefix === false) { - return _supportsCssAnimationWithPrefix; - } - } else { - if (_supportsCssAnimation === true || _supportsCssAnimation === false) { - return _supportsCssAnimation; - } + if (allowPrefix && (_supportsCssAnimationWithPrefix === true || _supportsCssAnimationWithPrefix === false)) { + return _supportsCssAnimationWithPrefix; + } + if (_supportsCssAnimation === true || _supportsCssAnimation === false) { + return _supportsCssAnimation; } let animation = false;