Permalink
Browse files

Event: Empty namespaces should be uneventfully ignored

Thanks @hamishdickson for the report!

Closes gh-1769
  • Loading branch information...
dmethvin committed Dec 10, 2014
1 parent b779831 commit 8653068dd6b8a515f5c1d8a0fda4479e9534103e
Showing with 12 additions and 1 deletion.
  1. +1 −1 src/event.js
  2. +11 −0 test/unit/event.js
View
@@ -15,7 +15,7 @@ var
rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/,
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
- rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
+ rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
function returnTrue() {
return true;
View
@@ -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);

0 comments on commit 8653068

Please sign in to comment.