Commit 0b784ed8 authored by Scott J. Miles's avatar Scott J. Miles

Change addOnUnload events to fire at window.onbeforeunload (except on IE), refs #3567.

git-svn-id: http://svn.dojotoolkit.org/src/dojo/trunk@9367 560b804f-0ae3-0310-86f3-f6aa0a117693
parent 3f55e3c1
......@@ -270,25 +270,23 @@ if(typeof window != 'undefined'){
}
// END DOMContentLoaded
// IE WebControl hosted in an application can fire "beforeunload" and "unload"
// events when control visibility changes, causing Dojo to unload too soon. The
// following code fixes the problem
// Reference: http://support.microsoft.com/default.aspx?scid=kb;en-us;199155
if(dojo.isIE){
// IE WebControl hosted in an application can fire "beforeunload" and "unload"
// events when control visibility changes, causing Dojo to unload too soon. The
// following code fixes the problem
// Reference: http://support.microsoft.com/default.aspx?scid=kb;en-us;199155
dojo._handleNodeEvent(window, "beforeunload", function(){
dojo._unloading = true;
window.setTimeout(function() {
dojo._unloading = false;
}, 0);
window.setTimeout(function(){ dojo._unloading = false; }, 0);
});
dojo._handleNodeEvent(window, "unload", function(){
if(dojo._unloading){ dojo.unloaded(); }
});
}else{
// FIXME: dojo.unloaded requires dojo scope
dojo._handleNodeEvent(window, "beforeunload", function() { dojo.unloaded(); });
}
dojo._handleNodeEvent(window, "unload", function(){
if((!dojo.isIE)||(dojo.isIE && dojo._unloading)){
dojo.unloaded();
}
});
/*
OpenAjax.subscribe("OpenAjax", "onload", function(){
if(dojo._inFlightCount == 0){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment