From 365c5de0b986a71668e8368599a8ecaf238cc914 Mon Sep 17 00:00:00 2001 From: Michael Nowack Date: Tue, 30 Aug 2016 18:46:31 +0200 Subject: [PATCH] Do not execute event handler if not enabled and event type is touchcancel. handleEvent registers event listeners for the various touch events: touchstart, touchmove, touchend AND touchcancel. Event listeners check the state of IScroll and the event type and decide if they can run: > if ( !this.enabled || utils.eventType[e.type] !== this.initiated ) { > return; > } this.enabled ist set to true in the construct method IScroll. utils.eventType is undefined for e.type === "touchcancel", as is this.initiated if you are scrolling outside your wrapper and _start was not executed. Both expressions evaluate to false and thus the event listeners execute. (SEO: Found the problem on Android 4.4.2 Webview, which emits touchcancel events) --- src/utils.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils.js b/src/utils.js index 8b5e9153..89aeec84 100644 --- a/src/utils.js +++ b/src/utils.js @@ -180,6 +180,7 @@ var utils = (function () { touchstart: 1, touchmove: 1, touchend: 1, + touchcancel: 1, mousedown: 2, mousemove: 2, @@ -296,4 +297,4 @@ var utils = (function () { }; return me; -})(); \ No newline at end of file +})();