Delegation with namespaced events error
- $(document).delegate("body", "foo.bar", function(){
- alert('bar')
- }).delegate("body", "foo.zar", function(){
- alert('zar')
- });
- $(document.body).trigger("foo.bar");
Alerts "zar" and "bar" when it should only alert "bar". This is a problem with liveHandler only checking
- handleObj.origType.replace( rnamespaces, "" ) === event.type
Which will match anything foo
VS something more like:
- handleObj.origType === event.type+(event.namespace ? "."+event.namespace : "")
And in handle, you have to add the namespace to the event like:
- event.namespace = namespaces.join(".")
There are other, probably better ways of doing this, but this is the easiest. I wanted to release our default events plugin that lets you do:
- $('.tab').bind('default.show', function(){})
Tonight. So, I'd really like to get this into the nightly as soon as possible. Brian Moschel should be making a pull request in a few hours, so let us know if it needs any changes.
Also, I submitted a 4 fixes a month or so ago that never got added. Any reason for the delay? Seems like the last update in jquery/jquery was a month ago. I know you are crazy busy, but let me know if there is anything I can do to help these get in. There's a few other plugins that need some of these changes on the way. But this delegation error is by far the most important.
Thanks!