Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fix touchEvent support for touch-action
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
RByers committed Dec 31, 2013
1 parent 932a9b8 commit 732cb6a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/touch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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?
Expand Down Expand Up @@ -322,7 +322,7 @@
}
};

if (!HAS_TOUCH_ACTION) {
if (!HAS_TOUCH_ACTION_DELAY) {
INSTALLER = new scope.Installer(touchEvents.elementAdded, touchEvents.elementRemoved, touchEvents.elementChanged, touchEvents);
}

Expand Down

0 comments on commit 732cb6a

Please sign in to comment.