id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	blocking	blockedby
8873	IE memory leak in jquery support function	agnes@…	shghs	"The following code in the jquery support detection function will cause a memory leak in IE. 
{{{
if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
		div.attachEvent(""onclick"", function click() {
			// Cloning a node shouldn't copy over any
			// bound event handlers (IE does this)
			jQuery.support.noCloneEvent = false;
			div.detachEvent(""onclick"", click);
		});
		div.cloneNode(true).fireEvent(""onclick"");
	}
}}}

This is because the detachEvent is only ever called on the div and not never on the cloned div.

It can be fixed simply with this code:

{{{
    if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
        var click = function() {
			// Cloning a node shouldn't copy over any
			// bound event handlers (IE does this)
			jQuery.support.noCloneEvent = false;
			this.detachEvent(""onclick"", click);
		};
		div.attachEvent(""onclick"", click);
		div.cloneNode(true).fireEvent(""onclick"");
        div.detachEvent(""onclick"", click);
	}
}}}


"	bug	closed	low	1.next	support	1.5.2	fixed				
