1 | (function($) {
|
2 | $.events = function(selector, root) {
|
3 | var s = [];
|
4 | $(selector || '*', root).addBack().each(function() {
|
5 |
|
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); |
\ | No newline at end of file |