JQuery 1.5 memory leak in IE8

I believe that I might have discovered a fairly simple leak in the latest jQuery version.

var  listen = function(){};
var testLeak = function(){
    for(var i = 0; i<100; i++){
        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 );
        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, 100);
}

I created a jsfiddle project that demonstrates this:

http://jsfiddle.net/rJ8x5/8/

It is important to note that if I do not call .remove (), this does not leak, and if I call .remove (), but set the .elem reference to zero, it also does not flow. It is as if jQuery is holding a reference to an element when I call .remove (), which in turn contains a reference to .elem. Any suggestions? As you can see, I set the wrappedListener to null, trying to prevent any inadvertent closures, but that doesn't help.

EDIT: I updated the jsfiddle script to actually add node to the DOM. This does not affect behavior.

EDIT2: , , , script remove(). ...

+1
1

, ( "var item = {};" ), detachevent javascript/DOM. . remove(), , ,

0