From 732cb6ad401145023e6cd97989aeee2f84969b3e Mon Sep 17 00:00:00 2001 From: RByers Date: Mon, 30 Dec 2013 20:35:57 -0500 Subject: [PATCH] Fix touchEvent support for touch-action Change HAS_TOUCH_ACTION to HAS_TOUCH_ACTION_DELAY. Even with touch-action we should still avoid unnecessary touch handlers. It's only with touch-action-delay: none that we can be sure our handlers won't delay threaded scrolling. This works around #116 for now without actually solving it completely. --- src/touch.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/touch.js b/src/touch.js index 28e25563..dae7fc46 100644 --- a/src/touch.js +++ b/src/touch.js @@ -15,7 +15,7 @@ var CLICK_COUNT_TIMEOUT = 200; var ATTRIB = 'touch-action'; var INSTALLER; - var HAS_TOUCH_ACTION = (typeof document.head.style.touchAction) === 'string'; + var HAS_TOUCH_ACTION_DELAY = (typeof document.head.style.touchActionDelay) === 'string'; // handler block for native touch events var touchEvents = { @@ -27,14 +27,14 @@ 'touchcancel' ], register: function(target) { - if (HAS_TOUCH_ACTION) { + if (HAS_TOUCH_ACTION_DELAY) { dispatcher.listen(target, this.events); } else { INSTALLER.enableOnSubtree(target); } }, unregister: function(target) { - if (HAS_TOUCH_ACTION) { + if (HAS_TOUCH_ACTION_DELAY) { dispatcher.unlisten(target, this.events); } else { // TODO(dfreedman): is it worth it to disconnect the MO? @@ -322,7 +322,7 @@ } }; - if (!HAS_TOUCH_ACTION) { + if (!HAS_TOUCH_ACTION_DELAY) { INSTALLER = new scope.Installer(touchEvents.elementAdded, touchEvents.elementRemoved, touchEvents.elementChanged, touchEvents); }