[dojo-contributors] IE7 leaks and testBench
savoyboy at gmail.com
Wed Aug 8 16:50:31 EDT 2007
Here's a link to an excellent article detailing this leak pattern in IE. To
my knowledge, this leak has not yet been fixed in IE7.
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.
To be safe never add an onclick (or any other) event handler to a DOM node
before it has been appended to the document.
On 8/8/07, Scott J. Miles <sjmiles at turboajax.com> 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.
> +65 document.body.appendChild(tmpNode);
> into testBench makes the reported leaks go away (c.f.
> http://trac.dojotoolkit.org/ticket/3531 and
> I'm not sure how often this happens in real life, so this may be less of
> a problem than it appears.
> I would suggest that code that produces phantom nodes (and attaches
> events to them) should be responsible for making them go away (vs.
> trying to solve this in event code). Otoh, running the Dijit cleanup
> code in IE7 could provide a measure of blind protection (with some costs
> at unload-time).
> I did some basic Googling, but I didn't find any reference to this
> problem specifically on IE7 (although I seem to be pretty bad at writing
> Google queries).
> Scott J. Miles
> TurboAjax Group
> dojo-contributors mailing list
> dojo-contributors at dojotoolkit.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the dojo-contributors