Skip to content

Commit

Permalink
Merge pull request #3520 from Leaflet/stable-emulated-touch
Browse files Browse the repository at this point in the history
Backport master's L.Browser.touch, fixes #3466
  • Loading branch information
mourner committed Jun 8, 2015
2 parents f3dca3b + 981ee47 commit 8f02433
Showing 1 changed file with 2 additions and 32 deletions.
34 changes: 2 additions & 32 deletions src/core/Browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,38 +32,8 @@
opera3d = 'OTransition' in doc.style,
any3d = !window.L_DISABLE_3D && (ie3d || webkit3d || gecko3d || opera3d) && !phantomjs;


// PhantomJS has 'ontouchstart' in document.documentElement, but doesn't actually support touch.
// https://github.com/Leaflet/Leaflet/pull/1434#issuecomment-13843151

var touch = !window.L_NO_TOUCH && !phantomjs && (function () {

var startName = 'ontouchstart';

// IE10+ (We simulate these into touch* events in L.DomEvent and L.DomEvent.Pointer) or WebKit, etc.
if (pointer || (startName in doc)) {
return true;
}

// Firefox/Gecko
var div = document.createElement('div'),
supported = false;

if (!div.setAttribute) {
return false;
}
div.setAttribute(startName, 'return;');

if (typeof div[startName] === 'function') {
supported = true;
}

div.removeAttribute(startName);
div = null;

return supported;
}());

var touch = !window.L_NO_TOUCH && !phantomjs && (pointer || 'ontouchstart' in window ||
(window.DocumentTouch && document instanceof window.DocumentTouch));

L.Browser = {
ie: ie,
Expand Down

0 comments on commit 8f02433

Please sign in to comment.