]> source.dussan.org Git - jquery.git/commitdiff
Fix #10567. Make sure quickIs matches correct class name.
authorDave Methvin <dave.methvin@gmail.com>
Mon, 24 Oct 2011 21:26:43 +0000 (17:26 -0400)
committerDave Methvin <dave.methvin@gmail.com>
Mon, 24 Oct 2011 21:26:43 +0000 (17:26 -0400)
src/event.js
test/unit/event.js

index a6cd82379fcd8aaabf9860c6c920f385c36b7b63..23e9ca0e00a558d1da3dff4886442e28181b649f 100644 (file)
@@ -16,7 +16,7 @@ var rnamespaces = /\.(.*)$/,
                        //   0  1    2   3      4         5
                        // [ _, tag, id, class, attrName, attrValue ]
                        quick[1] = ( quick[1] || "" ).toLowerCase();
-                       quick[3] = quick[3] && new RegExp( "\\b" + quick[3] + "\\b" );
+                       quick[3] = quick[3] && new RegExp( "(?:^|\\w)" + quick[3] + "(?:\\w|$)" );
                }
                return quick;
        },
index ef2bc19c88f4f614912989f8b05709162089c978..de9c225c1a2517a07e61693d2fcc3266ef26c24a 100644 (file)
@@ -2452,6 +2452,14 @@ test("delegated events quickIs", function() {
        markup.find( "b" ).attr( "devo", "NO" );
        check( "b", "b|[devo='NO'] p|.D" );
 
+       markup
+               .on( "blink", ".tricky", function() {
+                       ok( false, "triggered on wrong class name match" );
+               })
+               .find( "p" )
+                       .attr( "class", "tricky-match" )
+                       .trigger( "blink" );
+
        markup.remove();
 });