Skip to content

Commit 02269e9

Browse files
author
Sebastien Pereira
committed
map touch events only on touch devices. Ref #31.
1 parent 66fe64b commit 02269e9

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

events.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,8 @@ define([
2828
if (has("mspointer-events")) {
2929
mspointer.registerHandlers(targetElement);
3030
} else {
31-
if (has("touch-events")) {
32-
if (!has("touch-device")) {
33-
mouse.registerHandlers(targetElement);
34-
if (has("chrome")) {
35-
touch.registerHandlers(targetElement);
36-
}
37-
} else {
38-
touch.registerHandlers(targetElement);
39-
}
31+
if (has("touch-events") && has("touch-device")) {
32+
touch.registerHandlers(targetElement);
4033
} else {
4134
mouse.registerHandlers(targetElement);
4235
}

handlers/features.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ define([
77
has.add("touch-events", "ontouchstart" in document); // UA supports Touch Events
88
has.add("pointer-events", "onpointerdown" in document); // UA supports Pointer Events
99
has.add("mspointer-events", "onmspointerdown" in document); // UA supports Pointer Events (IE10+IE11 preview)
10-
has.add("chrome", /chrome/i.test(navigator.userAgent)); // UA is chrome.
1110
has.add("touch-device", /(mobile)|(android)/i.test(navigator.userAgent)); // mobile device
1211
has.add("css-touch-action", "touchAction" in document.body.style);// touch-action CSS
1312
has.add("css-ms-touch-action", "msTouchAction" in document.body.style);// -ms-touch-action CSS

0 commit comments

Comments
 (0)