You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2014/01/09 14:04:02 UTC
[16/50] [abbrv] git commit: WICKET-4909 ModalWindow overwrites
window.onbeforeunload
WICKET-4909 ModalWindow overwrites window.onbeforeunload
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/637690f5
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/637690f5
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/637690f5
Branch: refs/heads/sandbox/WICKET-4686
Commit: 637690f59dae71408b4f23ba34e3350e82aa78a2
Parents: a4e6bd6
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Tue Dec 17 17:28:13 2013 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Tue Dec 17 17:28:13 2013 +0200
----------------------------------------------------------------------
.../extensions/ajax/markup/html/modal/res/modal.js | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/637690f5/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
----------------------------------------------------------------------
diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
index a41aa85..51c4d3c 100644
--- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
+++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
@@ -731,10 +731,10 @@
}
}, this);
- // preserve old beforeunload handler
- this.old_onbeforeunload = window.onbeforeunload;
-
if (this.settings.unloadConfirmation) {
+ // preserve old beforeunload handler
+ this.old_onbeforeunload = window.onbeforeunload;
+
// new beforeunload handler - ask user before reloading window
window.onbeforeunload = function() {
return "Reloading this page will cause the modal window to disappear.";
@@ -828,9 +828,11 @@
window.onunload = this.old_onunload;
this.old_onunload = null;
- // restore old beforeunload handler
- window.onbeforeunload = this.old_onbeforeunload;
- this.old_onbeforeunload = null;
+ if (this.old_onbeforeunload) {
+ // restore old beforeunload handler
+ window.onbeforeunload = this.old_onbeforeunload;
+ this.old_onbeforeunload = null;
+ }
// hids and cleanup the mask
this.destroyMask();