Event: Empty namespaces should be uneventfully ignored

Thanks @hamishdickson for the report!

Closes gh-1769
This commit is contained in:
Dave Methvin 2014-12-09 19:59:56 -05:00
parent b77983173e
commit 8653068dd6
2 changed files with 12 additions and 1 deletions

View File

@ -15,7 +15,7 @@ var
rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/,
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
function returnTrue() {
return true;

View File

@ -583,6 +583,17 @@ test("namespace-only event binding is a no-op", function(){
.off("whoops");
});
test("Empty namespace is ignored", function(){
expect( 1 );
jQuery("#firstp")
.on( "meow.", function( e ) {
equal( e.namespace, "", "triggered a namespace-less meow event" );
})
.trigger("meow.")
.off("meow.");
});
test("on(), with same function", function() {
expect(2);