Skip to content
Permalink
Browse files

Restored /g flag to rspaces; Adds unit tests; Supplements #9008

  • Loading branch information...
rwaldron committed Apr 29, 2011
1 parent e5f4ec8 commit ca367674c1f741fef01780ba09431392be8a0e49
Showing with 17 additions and 1 deletion.
  1. +1 −1 src/event.js
  2. +16 −0 test/unit/event.js
@@ -4,7 +4,7 @@ var hasOwn = Object.prototype.hasOwnProperty,
rnamespaces = /\.(.*)$/,
rformElems = /^(?:textarea|input|select)$/i,
rperiod = /\./g,
rspaces = /\s+/,
rspaces = /\s+/g,
rescape = /[^\w\s.|`]/g,
fcleanup = function( nm ) {
return nm.replace(rescape, "\\$&");
@@ -68,6 +68,22 @@ test("bind(), multiple events at once", function() {
equals( mouseoverCounter, 1, "bind() with multiple events at once" );
});

test("bind(), five events at once", function() {
expect(1);

var count = 0,
handler = function(event) {
count++;
};

jQuery("#firstp").bind("click mouseover foo bar baz", handler)
.trigger("click").trigger("mouseover")
.trigger("foo").trigger("bar")
.trigger("baz");

equals( count, 5, "bind() five events at once" );
});

test("bind(), multiple events at once and namespaces", function() {
expect(7);

0 comments on commit ca36767

Please sign in to comment.
You can’t perform that action at this time.