From: Rick Waldron Date: Fri, 29 Apr 2011 01:14:12 +0000 (-0400) Subject: Restored /g flag to rspaces; Adds unit tests; Supplements #9008 X-Git-Tag: 1.6~7^2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ca367674c1f741fef01780ba09431392be8a0e49;p=jquery.git Restored /g flag to rspaces; Adds unit tests; Supplements #9008 --- diff --git a/src/event.js b/src/event.js index 09ea02e75..f712f0deb 100644 --- a/src/event.js +++ b/src/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, "\\$&"); diff --git a/test/unit/event.js b/test/unit/event.js index 0424538d6..13877e019 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -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);