diff --git a/addons/web/static/src/core/browser/browser.js b/addons/web/static/src/core/browser/browser.js index a43a27da704..f7baaaea5b0 100644 --- a/addons/web/static/src/core/browser/browser.js +++ b/addons/web/static/src/core/browser/browser.js @@ -40,6 +40,7 @@ export const browser = { fetch: window.fetch.bind(window), innerHeight: window.innerHeight, innerWidth: window.innerWidth, + ontouchstart: window.ontouchstart, }; Object.defineProperty(browser, "location", { @@ -73,9 +74,7 @@ export function makeRAMLocalStorage() { return { setItem(key, value) { store[key] = value; - window.dispatchEvent( - new StorageEvent('storage', { key, newValue: value }) - ); + window.dispatchEvent(new StorageEvent("storage", { key, newValue: value })); }, getItem(key) { return store[key]; @@ -85,9 +84,7 @@ export function makeRAMLocalStorage() { }, removeItem(key) { delete store[key]; - window.dispatchEvent( - new StorageEvent('storage', { key, newValue: null }) - ); + window.dispatchEvent(new StorageEvent("storage", { key, newValue: null })); }, get length() { return Object.keys(store).length; diff --git a/addons/web/static/src/core/browser/feature_detection.js b/addons/web/static/src/core/browser/feature_detection.js index 1c32494640f..3b243f098cd 100644 --- a/addons/web/static/src/core/browser/feature_detection.js +++ b/addons/web/static/src/core/browser/feature_detection.js @@ -20,8 +20,10 @@ export function isAndroid() { } export function isIOS() { - return /(iPad|iPhone|iPod)/i.test(browser.navigator.userAgent) || - (browser.navigator.platform === 'MacIntel' && maxTouchPoints() > 1); + return ( + /(iPad|iPhone|iPod)/i.test(browser.navigator.userAgent) || + (browser.navigator.platform === "MacIntel" && maxTouchPoints() > 1) + ); } export function isOtherMobileOS() { @@ -41,7 +43,7 @@ export function isIosApp() { } export function hasTouch() { - return "ontouchstart" in window || "onmsgesturechange" in window; + return browser.ontouchstart !== undefined; } export function maxTouchPoints() {