Created
February 19, 2013 11:09
-
-
Save oberhamsi/4984940 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.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 ); | |
}); | |
} | |
}); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
usage: