mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
event data comes from currentTarget, not target
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user