wishthis/node_modules/fomantic-ui/test/helpers/jquery-events.js

29 lines
1,010 B
JavaScript
Raw Normal View History

2022-01-13 13:00:31 +00:00
(function($) {
$.events = function(selector, root) {
var s = [];
$(selector || '*', root).addBack().each(function() {
// the following line is the only change
var e = $._data(this, 'events');
if(!e) return;
s.push(this.tagName);
if(this.id) s.push('#', this.id);
if(this.className) s.push('.', this.className.replace(/ +/g, '.'));
for(var p in e) {
var r = e[p],
h = r.length - r.delegateCount;
if(h)
s.push('\n', h, ' ', p, ' handler', h > 1 ? 's' : '');
if(r.delegateCount) {
for(var q = 0; q < r.length; q++)
if(r[q].selector) s.push('\n', p, ' for ', r[q].selector);
}
}
s.push('\n\n');
});
return s.join('');
}
$.fn.events = function(selector) {
return $.events(selector, this);
}
2022-06-08 10:36:39 +00:00
})(jQuery);