Skip to content

Commit 732cb6a

Browse files
author
RByers
committed
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 jquery-archive#116 for now without actually solving it completely.
1 parent 932a9b8 commit 732cb6a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/touch.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
var CLICK_COUNT_TIMEOUT = 200;
1616
var ATTRIB = 'touch-action';
1717
var INSTALLER;
18-
var HAS_TOUCH_ACTION = (typeof document.head.style.touchAction) === 'string';
18+
var HAS_TOUCH_ACTION_DELAY = (typeof document.head.style.touchActionDelay) === 'string';
1919

2020
// handler block for native touch events
2121
var touchEvents = {
@@ -27,14 +27,14 @@
2727
'touchcancel'
2828
],
2929
register: function(target) {
30-
if (HAS_TOUCH_ACTION) {
30+
if (HAS_TOUCH_ACTION_DELAY) {
3131
dispatcher.listen(target, this.events);
3232
} else {
3333
INSTALLER.enableOnSubtree(target);
3434
}
3535
},
3636
unregister: function(target) {
37-
if (HAS_TOUCH_ACTION) {
37+
if (HAS_TOUCH_ACTION_DELAY) {
3838
dispatcher.unlisten(target, this.events);
3939
} else {
4040
// TODO(dfreedman): is it worth it to disconnect the MO?
@@ -322,7 +322,7 @@
322322
}
323323
};
324324

325-
if (!HAS_TOUCH_ACTION) {
325+
if (!HAS_TOUCH_ACTION_DELAY) {
326326
INSTALLER = new scope.Installer(touchEvents.elementAdded, touchEvents.elementRemoved, touchEvents.elementChanged, touchEvents);
327327
}
328328

0 commit comments

Comments
 (0)