event data comes from currentTarget, not target

This commit is contained in:
David Greenspan
2012-07-09 19:28:29 -07:00
parent c046ddbd0c
commit ae55d9dd11
2 changed files with 13 additions and 1 deletions

View File

@@ -647,7 +647,7 @@ Meteor.ui = Meteor.ui || {};
continue;
}
var event_data = findEventData(event.target);
var event_data = findEventData(event.currentTarget);
// Call the app's handler/callback
var returnValue = h.callback.call(event_data, event);

View File

@@ -1515,6 +1515,18 @@ Tinytest.add("liveui - event handling", function(test) {
div.kill();
Meteor.flush();
// Event data comes from event.currentTarget, not event.target
var data_buf = [];
div = OnscreenDiv(Meteor.ui.render(function() {
return "<ul>"+Meteor.ui.chunk(function() {
return '<li id="funyard">Hello</li>';
}, { event_data: {x:'listuff'} })+"</ul>";
}, { event_data: {x:'ulstuff'},
events: { 'click ul': function() { data_buf.push(this); }}}));
clickElement(getid("funyard"));
test.equal(data_buf, [{x:'ulstuff'}]);
div.kill();
Meteor.flush();
});
Tinytest.add("liveui - cleanup", function(test) {