Peter Foti :

> function addEvent( obj, type, fn ) {
>   if ( obj.attachEvent ) {
>     obj['e'+type+fn] = fn;
>     obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
>     obj.attachEvent( 'on'+type, obj[type+fn] );
>   }

This is perfectly example of how you can setup circular reference
pattern, which cause memory leak in older IE.

Variable Object of addEvent -> obj -> obj[type+fn] ->
function[[Scope]] -> Variable Object of addEvent

You cannot prevent this leak. The only one unreliable way is to setup
unload handler which breaks this circular reference.

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to