// JavaScript Document

$.fn.listHandlers = function(events, outputFunction) {
    return this.each(function(count){
        var elem = $(this)[0];
        for ( var i in elem ) {
            if(/jQuery\d+/.test(i)) {
                $.cache[elem[i]] && $.cache[elem[i]].events &&
                $.each($.cache[elem[i]].events, function(name){
                    if((new RegExp('^(' + (events === '*' ? '.+' : events.replace(',','|').replace(/^on/i,'')) + ')$' ,'i')).test(name)) {
                        $.each(this, function(){
                            // Now 'this' refers to each property value of specific event:
                            outputFunction(elem, '\n' + count + ': [' + name + '] : ' + this );
                        });
                    }
                });
            }
        }
    });
}