When setting up a event handler (submit, click, keypress, whatever) what is the fastest and most efficient way to get data to the handler and use it in the handler? Should I be doing something like:
$obj.data({name: value, ...});
$obj.click(function(e){
var $this = $(e.target),
name = $this.data(name);
});
Or is it better to do something like this:
$obj.bind('click', {name: value}, function(e) {
var $this = $(e.target),
name = e.data.name;
});
Are there other considerations I am omitting?