[jQuery] Fading image memory leak (what am I doing wrong?)

[jQuery] Fading image memory leak (what am I doing wrong?)


Hi,
So I have this script that copies a node, then uses an ajax call to
load a new image into the new node. Then once the image is done
loading, fades the old image out. After that, it removed the old node.
Works great on my mac, but IE has a horrible memory leak. I verified
the leak with DRIP. It's definitely is happening when this function is
being called. Any assistance would be spiffy.
function doImageSetup() {
var imgDiv = $("#image_div span.img_hold"); // get target
var newish = imgDiv.clone(); // clone
newish.css("z-index", "-1"); // set it behind imgDiv
imgDiv.parent().prepend(newish); // append it to
newish.load("getimg.php", function(){ doImageFade(imgDiv,
newish);}); load image
}
function doImageFade(o, n) {
ni = n.children("img"); // select image in new div
ni.load(function(){ // once the new image is finished loading
o.children("img").fadeOut(2000, function(){ // fade out old img
and then
o.remove(); // get rid of it
n.css("z-index", "0"); // move new div forward
setTimeout("doImageSetup()", 10000); // 10 second timer
});
});
}