From 89dedbf866e612e07bc451fa34c514d8a4eea38e Mon Sep 17 00:00:00 2001 From: lucho870601 Date: Tue, 27 May 2014 21:37:02 +0200 Subject: [PATCH 1/2] Added Firefox 27+ to the "notNeeded" browsers since it does not have tap delay when the content is not zoomable - https://bugzilla.mozilla.org/show_bug.cgi?id=922896 --- lib/fastclick.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/fastclick.js b/lib/fastclick.js index 05b94b79..539bb9ef 100644 --- a/lib/fastclick.js +++ b/lib/fastclick.js @@ -723,6 +723,7 @@ FastClick.notNeeded = function(layer) { 'use strict'; var metaViewport; var chromeVersion; + var firefoxVersion; // Devices that don't support touch don't need FastClick if (typeof window.ontouchstart === 'undefined') { @@ -754,6 +755,18 @@ FastClick.notNeeded = function(layer) { } } + // Firefox version - zero for other browsers + firefoxVersion = +(/Firefox\/([0-9]+)/.exec(navigator.userAgent) || [,0])[1]; + + if (firefoxVersion >= 27) { + // Firefox 27+ does not have tap delay if the content is not zoomable - https://bugzilla.mozilla.org/show_bug.cgi?id=922896 + + metaViewport = document.querySelector('meta[name=viewport]'); + if (metaViewport && metaViewport.content.indexOf('user-scalable=no') !== -1) { + return true; + } + } + // IE10 with -ms-touch-action: none, which disables double-tap-to-zoom (issue #97) if (layer.style.msTouchAction === 'none') { return true; From 2bfeeceafdea62c3bdb7adba829dd1a2cefe1aad Mon Sep 17 00:00:00 2001 From: lucho870601 Date: Wed, 28 May 2014 16:54:54 +0200 Subject: [PATCH 2/2] Added width=device-width check for Firefox similar to Chrome. The behavior seems the same - we do not need fastclick. --- lib/fastclick.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/fastclick.js b/lib/fastclick.js index 539bb9ef..9fc245fd 100644 --- a/lib/fastclick.js +++ b/lib/fastclick.js @@ -762,7 +762,7 @@ FastClick.notNeeded = function(layer) { // Firefox 27+ does not have tap delay if the content is not zoomable - https://bugzilla.mozilla.org/show_bug.cgi?id=922896 metaViewport = document.querySelector('meta[name=viewport]'); - if (metaViewport && metaViewport.content.indexOf('user-scalable=no') !== -1) { + if (metaViewport && (metaViewport.content.indexOf('user-scalable=no') !== -1 || document.documentElement.scrollWidth <= window.outerWidth)) { return true; } }