]> source.dussan.org Git - jquery.git/commitdiff
Fix live mouseenter and mouseleave binding so they can be activated by triggers....
authorBrian Brennan <me@brianlovesthings.com>
Sun, 17 Apr 2011 18:58:20 +0000 (11:58 -0700)
committerJohn Resig <jeresig@gmail.com>
Sun, 17 Apr 2011 18:58:20 +0000 (11:58 -0700)
src/event.js
test/unit/event.js

index 32d51d0544e330c6c5a0b9f77ee74a03a7862e10..7ee4a3000fe7e2c2ad9707c6cd5ddbb8d6275228 100644 (file)
@@ -1066,7 +1066,7 @@ jQuery.each(["live", "die"], function( i, name ) {
 
                        preType = type;
 
-                       if ( type === "focus" || type === "blur" ) {
+                       if ( type === "focus" || type === "blur" || type === "mouseenter" || type === "mouseleave" ) {
                                types.push( liveMap[ type ] + namespaces );
                                type = type + namespaces;
 
index a1aee191f9e13b7efe3f5a7f95ee6ccb6e66226a..487388c4df462aa29eaadf9967dc655f62e73320 100644 (file)
@@ -832,7 +832,7 @@ test("trigger() bubbling", function() {
 });
 
 test("trigger(type, [data], [fn])", function() {
-       expect(14);
+       expect(16);
 
        var handler = function(event, a, b, c) {
                equals( event.type, "click", "check passed data" );
@@ -849,7 +849,24 @@ test("trigger(type, [data], [fn])", function() {
                ok( true, "Native call was triggered" );
        };
 
-       // Triggers handlrs and native
+       
+       $elem.live('mouseenter', function(){
+               ok( true, 'Trigger mouseenter bound by live' );
+       });
+
+       $elem.live('mouseleave', function(){
+               ok( true, 'Trigger mouseleave bound by live' );
+       });
+
+       $elem.trigger('mouseenter');
+
+       $elem.trigger('mouseleave');
+
+       $elem.die('mouseenter');
+
+       $elem.die('mouseleave');
+        
+        // Triggers handlrs and native
        // Trigger 5
        $elem.bind("click", handler).trigger("click", [1, "2", "abc"]);