aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2009-12-06 16:55:08 -0800
committerJohn Resig <jeresig@gmail.com>2009-12-06 16:55:08 -0800
commitaea5b091954b3c823b318b392660b22c7b1e978a (patch)
tree162587afef6358c41d1e892cd1169e8daba042f7 /src
parent1fe9ff548251d44c36b051abaa14abb260831a4a (diff)
downloadjquery-aea5b091954b3c823b318b392660b22c7b1e978a.tar.gz
jquery-aea5b091954b3c823b318b392660b22c7b1e978a.zip
Adding in cross-browser onbeforeunload support. Fixes #4106.
Diffstat (limited to 'src')
-rw-r--r--src/event.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/event.js b/src/event.js
index bf7798bb7..d9401c99e 100644
--- a/src/event.js
+++ b/src/event.js
@@ -327,6 +327,8 @@ jQuery.event = {
}
}
+
+ return event.result;
},
props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
@@ -432,6 +434,21 @@ jQuery.event = {
}
},
special: {}
+ },
+ beforeunload: {
+ setup: function( data, namespaces, fn ) {
+ // We only want to do this special case on windows
+ if ( this.setInterval ) {
+ this.onbeforeunload = fn;
+ }
+
+ return false;
+ },
+ teardown: function( namespaces, fn ) {
+ if ( this.onbeforeunload === fn ) {
+ this.onbeforeunload = null;
+ }
+ }
}
}
};