I suppose it is rear to use multiple namespaces to unbind an event and
that it is the reason why no one spotted this bug (I spotted it by
examining code, not by using the feature).

This is the problem:

$("div").bind("click.aaa.bbb", function(){...});

$("div").unbind("click.a.bbb"); //this is unbinding the previous
bind!!!

Now someone would suppose: "Well it seams fine, there is .bbb so it
will unbind click.aaa.bbb too", but it is not true:

$("div").unbind("click.bbb.other") // will not unbind click.aaa.bbb


The problem seams to be the generated regexp into event.remove() and
event.handle():

var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join(".*\
\.") + "(\\.|$)");

that for me would be:

var namespace = RegExp("(^|\\.)" + namespaces.slice().sort().join("\\.
(?:.*\\.)?") + "(\\.|$)");

Am I missing something here?

Here is a test-case http://jsbin.com/aledo
And here is the same case with the corrected event.remove() function:
http://jsbin.com/eqofo
(I hope jsbin.com has no problems any more)

Will I open a ticket?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to