aboutsummaryrefslogtreecommitdiffstats
path: root/src/support.js
diff options
context:
space:
mode:
authorJustin Meyer <justinbmeyer@gmail.com>2009-12-04 11:28:50 -0500
committerjeresig <jeresig@gmail.com>2009-12-04 11:28:50 -0500
commitd42afd0f657d12d6daba6894d40226bea83fe1b6 (patch)
tree242ceb87da56506dc09744eb0196f1f60edc926a /src/support.js
parentc6a0211e57cfc8da15f7993e71e27256aefc7f65 (diff)
downloadjquery-d42afd0f657d12d6daba6894d40226bea83fe1b6.tar.gz
jquery-d42afd0f657d12d6daba6894d40226bea83fe1b6.zip
Adding in support for bubbling submit and change events, thanks to the patch by Justin Meyer. Includes a delegation test suite for manually testing to see if the events work as intended.
Diffstat (limited to 'src/support.js')
-rw-r--r--src/support.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/support.js b/src/support.js
index 5fa45d230..ad8566d8b 100644
--- a/src/support.js
+++ b/src/support.js
@@ -91,6 +91,25 @@
div = null;
});
+ // Technique from Juriy Zaytsev
+ // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
+ var eventSupported = function( eventName ) {
+ var el = document.createElement("div");
+ eventName = "on" + eventName;
+
+ var isSupported = (eventName in el);
+ if ( !isSupported ) {
+ el.setAttribute(eventName, "return;");
+ isSupported = typeof el[eventName] === "function";
+ }
+ el = null;
+
+ return isSupported;
+ };
+
+ jQuery.support.submitBubbles = eventSupported("submit");
+ jQuery.support.changeBubbles = eventSupported("change");
+
// release memory in IE
root = script = div = all = a = null;
})();