From: <pk...@us...> - 2010-09-26 06:29:19
|
Revision: 29623 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=29623&view=rev Author: pkdille Date: 2010-09-26 06:29:13 +0000 (Sun, 26 Sep 2010) Log Message: ----------- [bp/r29589] [FIX] Solve bugs of variables 'undefined is null or not object' at unloading of the page with IE Modified Paths: -------------- branches/6.x/lib/jquery_tiki/tiki-jquery.js Modified: branches/6.x/lib/jquery_tiki/tiki-jquery.js =================================================================== --- branches/6.x/lib/jquery_tiki/tiki-jquery.js 2010-09-26 03:15:53 UTC (rev 29622) +++ branches/6.x/lib/jquery_tiki/tiki-jquery.js 2010-09-26 06:29:13 UTC (rev 29623) @@ -1698,4 +1698,31 @@ }; })($jq); - +// Prevent memory leaks in IE +// Window isn't included so as not to unbind existing unload events +// More info: +// - http://isaacschlueter.com/2006/10/msie-memory-leaks/ +if ( window.attachEvent && !window.addEventListener ) { + window.attachEvent("onunload", function() { + for ( var id in jQuery.cache ) { + var item = jQuery.cache[ id ]; + if ( item.handle ) { + if ( item.handle.elem === window ) { + for ( var type in item.events ) { + if ( type !== "unload" ) { + // Try/Catch is to handle iframes being unloaded, see #4280 + try { + jQuery.event.remove( item.handle.elem, type ); + } catch(e) {} + } + } + } else { + // Try/Catch is to handle iframes being unloaded, see #4280 + try { + jQuery.event.remove( item.handle.elem ); + } catch(e) {} + } + } + } + }); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |