Fix #12061. Avoid window.onbeforeunload to permit multiple handlers. Close gh-894.

This commit is contained in:
Oleg
2012-08-15 00:10:10 +04:00
committed by Dave Methvin
parent 08341437e0
commit 9dd0b01017
2 changed files with 56 additions and 18 deletions

View File

@@ -549,16 +549,11 @@ jQuery.event = {
},
beforeunload: {
setup: function( data, namespaces, eventHandle ) {
// We only want to do this special case on windows
if ( jQuery.isWindow( this ) ) {
this.onbeforeunload = eventHandle;
}
},
postDispatch: function( event ) {
teardown: function( namespaces, eventHandle ) {
if ( this.onbeforeunload === eventHandle ) {
this.onbeforeunload = null;
// Even when returnValue equals to undefined Firefox will still show alert
if ( event.result !== undefined ) {
event.originalEvent.returnValue = event.result;
}
}
}