JSFiddle - React, Tailwind, and code Playground
by jitter
HTML
<script src="https://getfirebug.com/firebug-lite-debug.js"></script>
JavaScript
var listen = function() {},
testLeak = function() {
var item = {};
item.elem = $(document.createElement('div'));
item.addListener = function(name, listener) {
var self = this;
var wrappedListener = function() {
return listener.apply(self, arguments);
}
this.elem.bind(name, wrappedListener);
wrappedListener = null;
}
item.addListener('eventName', listen);
//un-comment the following to lines to verify unbind/remove work
//can be seen by comparing the console output
//item.elem.unbind();
//item.elem.remove();
console.log( item.elem.data() );
console.log( item.elem.data("events") );
};
$(document).ready(function() {
testLeak();
});