From f2d8ad34fa9dcfbf59c6c886d7e4b50bb0b18183 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Mon, 17 Mar 2014 14:55:25 +0100 Subject: [PATCH] Fix ol.BrowserFeature.HAS_TOUCH detection code Use goog.global instead goog.global.document.documentElement to avoid false negative results when using the chrome development tools (Touch Events emulation). Code borrowed from https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js except for the DocumentTouch part which is deprecated (https://developer.mozilla.org/en-US/docs/Web/API/DocumentTouch) Fixes #1869 --- src/ol/browserfeature.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/ol/browserfeature.js b/src/ol/browserfeature.js index f4e1c444d2..d05fb9f25c 100644 --- a/src/ol/browserfeature.js +++ b/src/ol/browserfeature.js @@ -157,9 +157,7 @@ ol.BrowserFeature.HAS_GEOLOCATION = 'geolocation' in goog.global.navigator; * @type {boolean} * @todo stability experimental */ -ol.BrowserFeature.HAS_TOUCH = ol.ASSUME_TOUCH || - (goog.global.document && - 'ontouchstart' in goog.global.document.documentElement); +ol.BrowserFeature.HAS_TOUCH = ol.ASSUME_TOUCH || 'ontouchstart' in goog.global; /**