X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fevent.js;h=662fc4848d21ba936da38a19c58103b86e8fb76a;hb=6048e40a4514445e17e9db255b949cb5e7a556c0;hp=7bbca2a79d507af35e30f3bbe0b62c24bcb88904;hpb=77344f4c50386690782ab8ddc92898a918f54f5c;p=jquery.git diff --git a/src/event.js b/src/event.js index 7bbca2a..662fc48 100644 --- a/src/event.js +++ b/src/event.js @@ -40,8 +40,9 @@ jQuery.event = { handle = jQuery.data(elem, "handle") || jQuery.data(elem, "handle", function(){ // Handle the second event of a trigger and when // an event is called after a page has unloaded - if ( typeof jQuery !== "undefined" && !jQuery.event.triggered ) - return jQuery.event.handle.apply(arguments.callee.elem, arguments); + return typeof jQuery !== "undefined" && !jQuery.event.triggered ? + jQuery.event.handle.apply(arguments.callee.elem, arguments) : + undefined; }); // Add elem as a property of the handle function // This is to prevent a memory leak with non-native @@ -115,7 +116,7 @@ jQuery.event = { // Namespaced event handlers var namespace = type.split("."); type = namespace.shift(); - namespace = RegExp(namespace.sort().join(".*\\.") + "(\\.|$)"); + namespace = RegExp("(^|\\.)" + namespace.sort().join(".*\\.") + "(\\.|$)"); if ( events[type] ) { // remove the given handler for the given type @@ -248,9 +249,11 @@ jQuery.event = { // Namespaced event handlers namespace = event.type.split("."); event.type = namespace.shift(); - namespace = RegExp(namespace.sort().join(".*\\.") + "(\\.|$)"); + // Cache this now, all = true means, any handler - all = !namespace && !event.exclusive; + all = !namespace.length && !event.exclusive; + + namespace = RegExp("(^|\\.)" + namespace.sort().join(".*\\.") + "(\\.|$)"); handlers = ( jQuery.data(this, "events") || {} )[event.type];