Skip to content

Commit

Permalink
Keep data.el alongside event.currentTarget
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Ashworth committed Jan 14, 2015
1 parent bbbefc7 commit e571a4e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ define(
Object.keys(rules).forEach(function(selector) {
if (!e.isPropagationStopped() && (parent = target.closest(selector)).length) {
data = data || {};
e.currentTarget = parent[0];
e.currentTarget = data.el = parent[0];
return rules[selector].apply(this, [e, data]);
}
}, this);
Expand Down
2 changes: 2 additions & 0 deletions test/spec/utils_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,9 @@ define(['lib/component', 'lib/utils', 'lib/debug'], function (defineComponent, u

$(document.body).trigger('click', myData);

var callbackArgs = spy.mostRecentCall.args;
expect(spy).toHaveBeenCalledWith(jasmine.any($.Event), myData);
expect(callbackArgs[1].el).toBe(document.body);
});

it('should pass the correct currentTarget', function () {
Expand Down

0 comments on commit e571a4e

Please sign in to comment.