Menu

.removeChild(..) harmful to Drip?

2007-02-27
2013-04-26
  • Stephen Stchur

    Stephen Stchur - 2007-02-27

    I've been using Drip 0.5 to try to check for DOM Leaks in IE6/7, and once thing I've noticed is that calls to .removeChild(..) actually seem to make DOM ref counts go up?  Is this correct?  Could it be that I'm removing an element that has children, and those children are then considered "leaks"?

    It almost seems best to to do any .removeChild(..) calls (as a method of clean up anyway).  To be sure... I can't really see why .removeChild(..) would help with cleaning up leaks anyway (but I'm a little puzzled that it seems to actually make matters worse).

    Has anyone else experienced anything like this?  Anyone have any insight?

    Thanks,
    Steve
    http://ecmascript.stchur.com/

     
    • Johan @ Cordys

      Johan @ Cordys - 2007-02-28

      Hi Steve,

      removeChild(..)  will only remove the element from the DOM tree but the elements are not actually freed and the reference to the removed child(s) will exist until page closes. This is a 'pseudo leak'. Solution for this is setting innerHTML=""  instead of removeChild(). see: http://outofhanwell.com/ieleak/index.php?title=Fixing_Leaks

       

Log in to post a comment.