You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
1009 B

  1. (function($) {
  2. $.events = function(selector, root) {
  3. var s = [];
  4. $(selector || '*', root).addBack().each(function() {
  5. // the following line is the only change
  6. var e = $._data(this, 'events');
  7. if(!e) return;
  8. s.push(this.tagName);
  9. if(this.id) s.push('#', this.id);
  10. if(this.className) s.push('.', this.className.replace(/ +/g, '.'));
  11. for(var p in e) {
  12. var r = e[p],
  13. h = r.length - r.delegateCount;
  14. if(h)
  15. s.push('\n', h, ' ', p, ' handler', h > 1 ? 's' : '');
  16. if(r.delegateCount) {
  17. for(var q = 0; q < r.length; q++)
  18. if(r[q].selector) s.push('\n', p, ' for ', r[q].selector);
  19. }
  20. }
  21. s.push('\n\n');
  22. });
  23. return s.join('');
  24. }
  25. $.fn.events = function(selector) {
  26. return $.events(selector, this);
  27. }
  28. })(jQuery);