JSFiddle - React, Tailwind, and code Playground
HTML
<div id="result"></div>
JavaScript
(function($) {
$.eventReport = function(selector, root) {
var s = [];
$(selector || '*', root).andSelf().each(function() {
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);
for(var p in e) s.push('\n', p);
s.push('\n\n');
});
return s.join('');
}
$.fn.eventReport = function(selector) {
return $.eventReport(selector, this);
}
})(jQuery);
var before = $.eventReport();
$('#nonexist').on('click', function(){console.log('wowowow');});
var after = $.eventReport();
$result = $('#result');
if(before==after)
{
$result.text('No new events.');
}
else
{
$result.text('There\'s a difference.');
}