Commit 51564bbd authored by Dave Methvin's avatar Dave Methvin

Event: Empty namespaces should be uneventfully ignored

Thanks @hamishdickson for the report!

Closes gh-1769
(cherry picked from commit 8653068dd6b8a515f5c1d8a0fda4479e9534103e)
parent 1ece10fb
...@@ -14,7 +14,7 @@ var rformElems = /^(?:input|select|textarea)$/i, ...@@ -14,7 +14,7 @@ var rformElems = /^(?:input|select|textarea)$/i,
rkeyEvent = /^key/, rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/, rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/,
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
function returnTrue() { function returnTrue() {
return true; return true;
......
...@@ -587,6 +587,17 @@ test("namespace-only event binding is a no-op", function(){ ...@@ -587,6 +587,17 @@ test("namespace-only event binding is a no-op", function(){
.off("whoops"); .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() { test("on(), with same function", function() {
expect(2); expect(2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment