fastclick
Advanced tools
Comparing version 0.6.10 to 0.6.11
/** | ||
* @preserve FastClick: polyfill to remove click delays on browsers with touch UIs. | ||
* | ||
* @version 0.6.9 | ||
* @version 0.6.11 | ||
* @codingstandard ftlabs-jsv2 | ||
@@ -248,4 +248,5 @@ * @copyright The Financial Times Limited [All Rights Reserved] | ||
case 'textarea': | ||
return true; | ||
case 'select': | ||
return true; | ||
return !this.deviceIsAndroid; | ||
case 'input': | ||
@@ -289,3 +290,3 @@ switch (target.type) { | ||
clickEvent = document.createEvent('MouseEvents'); | ||
clickEvent.initMouseEvent('click', true, true, window, 1, touch.screenX, touch.screenY, touch.clientX, touch.clientY, false, false, false, false, 0, null); | ||
clickEvent.initMouseEvent(this.determineEventType(targetElement), true, true, window, 1, touch.screenX, touch.screenY, touch.clientX, touch.clientY, false, false, false, false, 0, null); | ||
clickEvent.forwardedTouchEvent = true; | ||
@@ -295,3 +296,14 @@ targetElement.dispatchEvent(clickEvent); | ||
FastClick.prototype.determineEventType = function(targetElement) { | ||
'use strict;' | ||
//Issue #159: Android Chrome Select Box does not open with a synthetic click event | ||
if (this.deviceIsAndroid && targetElement.tagName.toLowerCase() === 'select') { | ||
return 'mousedown'; | ||
} | ||
return 'click'; | ||
} | ||
/** | ||
@@ -304,3 +316,4 @@ * @param {EventTarget|Element} targetElement | ||
if (this.deviceIsIOS && targetElement.setSelectionRange) { | ||
// Issue #160: on iOS 7, some input elements (e.g. date datetime) throw a vague TypeError on setSelectionRange. These elements don't have an integer value for the selectionStart and selectionEnd properties, but unfortunately that can't be used for detection because accessing the properties also throws a TypeError. Just check the type instead. Filed as Apple bug #15122724. | ||
if (this.deviceIsIOS && targetElement.setSelectionRange && targetElement.type.indexOf('date') !== 0 && targetElement.type !== 'time') { | ||
length = targetElement.value.length; | ||
@@ -514,2 +527,5 @@ targetElement.setSelectionRange(length, length); | ||
// Reset to prevent wrong click cancel on input (issue #156). | ||
this.cancelNextClick = false; | ||
this.lastClickTime = event.timeStamp; | ||
@@ -516,0 +532,0 @@ |
{ | ||
"name": "fastclick", | ||
"version": "0.6.10", | ||
"version": "0.6.11", | ||
"description": "Polyfill to remove click delays on browsers with touch UIs.", | ||
@@ -5,0 +5,0 @@ "maintainers": [ |
39725
7
677