A var clickEvents = $('#foo').data("events").click;
jQuery.each(clickEvents, function(key, value) {
console.log(value) // prints "function() { console.log('clicked!') }"
})
B $.fn.listHandlers = function(events, outputFunction) {
return this.each(function(i){
var elem = this, dEvents = $(this).data('events');
if (!dEvents) {return;}
$.each(dEvents, function(name, handler){
if((new RegExp('^(' + (events === '*' ? '.+' : events.replace(',','|').replace(/^on/i,'')) + ')$' ,'i')).test(name)) { $.each(handler, function(i,handler){ outputFunction(elem, '\n' + i + ': [' + name + '] : ' + handler ); });
}
});
});
};
C var clickEvents = $('#foo').data("events").click;
jQuery.each(clickEvents, function(key, value) { event.console.log(value);
})
D $.fn.listHandlers = function(events, outputFunction) {
return this.each(function(i){
var elem = this, dEvents = $(this).data('events');
$.each(dEvents, function(name, handler){
if((new RegExp('^(' + (events === '*' ? '.+' : events.replace(',','|').replace(/^on/i,'')) + ')$' ,'i')).test(name)) { $.each(handler, function(i,handler){ outputFunction(elem, '\n' + i + ': [' + name + '] : ' + handler );
});
}
});
});
};