Fixed a problem with multi-namespaced events not targetting the correct functions for execution.

This commit is contained in:
John Resig 2008-12-19 06:49:44 +00:00
parent 62bd7e6817
commit 80a6a91347

View file

@ -116,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
@ -249,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];