[dojo-contributors] IE7 leaks and testBench

Bill Keese bill at dojotoolkit.org
Thu Aug 9 07:27:16 EDT 2007


Scott J. Miles wrote:
> So, it appears that IE7 still has a basic DOM-JS circular reference leak 
> pattern. The variation in IE7 seems to be that it only occurs when the 
> DOM node is not part of a document.
> 
> We see this problem in spades in testBench because the created widgets 
> are attached to a temp node that is never attached to any document.

I don't see any file called testBench, so I assume you are talking about 
dijit/bench/benchTool.html?

Manager.js has cleanup code to destroy all the widgets on page unload. 
I updated it to run the cleanup code for IE7 as well as IE6, and that 
seems to fix the problem in http://trac.dojotoolkit.org/ticket/4046.

But I guess it's a safeguard, in the sense that when users detach a 
widget from the document they should be calling Widget.destroy() manually.

Of course for benchTool.html the widgets should probably be attached to 
the document, like you suggested.



Michael Shall wrote:
 > Note that this leak can occur ANY time a DOM node is created and an 
event handler is attached to the DOM node before the DOM node is 
appended to the document. So, this is broader than just the "temp" 
scenario that you describe. It applies to programmatic DOM manipulation 
in general.
 >

If that's really true then we need to rethink our architecture, because 
_Templated attaches all the events _before_ sticking this.domNode into 
the document.  Also we would have to desupport the API where you can 
create a widget without pre-specifying where the widget goes in the DOM, 
for example:

new dijit.form.Button();

Michael Schall wrote:
 > is there an array
 > or something of attachPoints on a widget that could be looped
 > generically to null them out?

No, but I can easily add one.



More information about the dojo-contributors mailing list