From 537472664d6c4f4150f0a9460d68a273ad107586 Mon Sep 17 00:00:00 2001 From: Daniel Freedman Date: Thu, 31 Oct 2013 14:32:09 -0700 Subject: [PATCH] Add the element under the pointer to track events as relatedTarget --- src/track.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/track.js b/src/track.js index 0b6e2dd..f25257b 100644 --- a/src/track.js +++ b/src/track.js @@ -76,6 +76,11 @@ * @type Object * @property trackInfo */ +/** + * The element currently under the pointer. + * @type Element + * @property relatedTarget + */ /** * The type of pointer that make the track gesture. * @type String @@ -97,7 +102,7 @@ (function(scope) { var dispatcher = scope.dispatcher; - var pointermap = new scope.PointerMap; + var pointermap = new scope.PointerMap(); var track = { events: [ 'pointerdown', @@ -141,13 +146,9 @@ xDirection: t.xDirection, yDirection: t.yDirection, trackInfo: t.trackInfo, + relatedTarget: inEvent.target, pointerType: inEvent.pointerType }; - if (inType === 'trackend') { - // TODO(dfreedman): this will leak shadowdom targets, replace with a - // more sophisticated mechanism - trackData._releaseTarget = inEvent.target; - } var e = dispatcher.makeEvent(inType, trackData); t.lastMoveEvent = inEvent; dispatcher.dispatchEvent(e, t.downTarget);