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
This commit is contained in:
Frederic Junod
2014-03-17 14:55:25 +01:00
parent ade384f842
commit f2d8ad34fa

View File

@@ -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;
/**