JSFiddle - React, Tailwind, and code Playground

JavaScript

var  listen = function(){};
var testLeak = function(){
    for(var i = 0; i<100; i++){
        var item = {};
        item.elem = $(document.createElement('div'));
        $(document.body).append(item.elem);
        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 );
        item.elem.unbind();
        item.elem.remove();  //with this un-commented, the loop leaks
        // item.elem = null; //with this also un-commented, the leak dissapears
    }
};
    
$(document).ready(function(){
    setInterval(testLeak, 1000);
});