]> source.dussan.org Git - jquery.git/commitdiff
Restored /g flag to rspaces; Adds unit tests; Supplements #9008
authorRick Waldron <waldron.rick@gmail.com>
Fri, 29 Apr 2011 01:14:12 +0000 (21:14 -0400)
committerRick Waldron <waldron.rick@gmail.com>
Fri, 29 Apr 2011 01:15:45 +0000 (21:15 -0400)
src/event.js
test/unit/event.js

index 09ea02e75bf6afed98c61118512a25296361bdcd..f712f0deb4fef1d72274c582afea99165a9b9e07 100644 (file)
@@ -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, "\\$&");
index 0424538d63512a3262f49cc05f8cfcc88fbafd40..13877e019118b8032feaee70a3cef46e45627846 100644 (file)
@@ -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);