fastclick
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "fastclick", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"main": "lib/fastclick.js", | ||
@@ -5,0 +5,0 @@ "ignore": [ |
/** | ||
* @preserve FastClick: polyfill to remove click delays on browsers with touch UIs. | ||
* | ||
* @version 1.0.2 | ||
* @version 1.0.3 | ||
* @codingstandard ftlabs-jsv2 | ||
@@ -200,2 +200,8 @@ * @copyright The Financial Times Limited [All Rights Reserved] | ||
/** | ||
* BlackBerry requires exceptions. | ||
* | ||
* @type boolean | ||
*/ | ||
var deviceIsBlackBerry10 = navigator.userAgent.indexOf('BB10') > 0; | ||
@@ -405,3 +411,6 @@ /** | ||
// immediately preceeding touch event (issue #52), so this fix is unavailable on that platform. | ||
if (touch.identifier === this.lastTouchIdentifier) { | ||
// Issue 120: touch.identifier is 0 when Chrome dev tools 'Emulate touch events' is set with an iOS device UA string, | ||
// which causes all touch events to be ignored. As this block only applies to iOS, and iOS identifiers are always long, | ||
// random integers, it's safe to to continue if the identifier is 0 here. | ||
if (touch.identifier && touch.identifier === this.lastTouchIdentifier) { | ||
event.preventDefault(); | ||
@@ -728,2 +737,3 @@ return false; | ||
var chromeVersion; | ||
var blackberryVersion; | ||
@@ -760,2 +770,23 @@ // Devices that don't support touch don't need FastClick | ||
if (deviceIsBlackBerry10) { | ||
blackberryVersion = navigator.userAgent.match(/Version\/([0-9]*)\.([0-9]*)/); | ||
// BlackBerry 10.3+ does not require Fastclick library. | ||
// https://github.com/ftlabs/fastclick/issues/251 | ||
if (blackberryVersion[1] >= 10 && blackberryVersion[2] >= 3) { | ||
metaViewport = document.querySelector('meta[name=viewport]'); | ||
if (metaViewport) { | ||
// user-scalable=no eliminates click delay. | ||
if (metaViewport.content.indexOf('user-scalable=no') !== -1) { | ||
return true; | ||
} | ||
// width=device-width (or less than device-width) eliminates click delay. | ||
if (document.documentElement.scrollWidth <= window.outerWidth) { | ||
return true; | ||
} | ||
} | ||
} | ||
} | ||
// IE10 with -ms-touch-action: none, which disables double-tap-to-zoom (issue #97) | ||
@@ -762,0 +793,0 @@ if (layer.style.msTouchAction === 'none') { |
{ | ||
"name": "fastclick", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Polyfill to remove click delays on browsers with touch UIs.", | ||
@@ -5,0 +5,0 @@ "maintainers": [ |
33244
678