Skip to content

Commit bd19544

Browse files
committed
No need to target find on the touchstart
1 parent 52df041 commit bd19544

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/touch.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
(function(scope) {
88
var dispatcher = scope.dispatcher;
99
var captureInfo = dispatcher.captureInfo;
10-
var findTarget = scope.findTarget;
1110
var allShadows = scope.targetFinding.allShadows.bind(scope.targetFinding);
1211
var pointermap = dispatcher.pointermap;
1312
var touchMap = Array.prototype.map.call.bind(Array.prototype.map);
@@ -144,18 +143,23 @@
144143
}
145144
return ret;
146145
},
146+
findTarget: function(ev) {
147+
if (this.currentTouchEvent.type === 'touchstart') {
148+
return this.currentTouchEvent.target;
149+
}
150+
return scope.findTarget(ev);
151+
},
147152
touchToPointer: function(inTouch) {
148153
var cte = this.currentTouchEvent;
149154
var e = dispatcher.cloneEvent(inTouch);
150155
// Spec specifies that pointerId 1 is reserved for Mouse.
151156
// Touch identifiers can start at 0.
152157
// Add 2 to the touch identifier for compatibility.
153158
var id = e.pointerId = inTouch.identifier + 2;
154-
e.target = captureInfo[id] || findTarget(e);
159+
e.target = captureInfo[id] || this.findTarget(e);
155160
e.bubbles = true;
156161
e.cancelable = true;
157162
e.detail = this.clickCount;
158-
e.button = 0;
159163
e.buttons = this.typeToButtons(cte.type);
160164
e.width = inTouch.webkitRadiusX || inTouch.radiusX || 0;
161165
e.height = inTouch.webkitRadiusY || inTouch.radiusY || 0;

0 commit comments

Comments
 (0)