diff options
author | Brian Brennan <me@brianlovesthings.com> | 2011-04-17 11:58:20 -0700 |
---|---|---|
committer | John Resig <jeresig@gmail.com> | 2011-04-17 11:58:20 -0700 |
commit | d46042e0500fb8241bf5ba012dfc779b535aa5fe (patch) | |
tree | 3d8d8418197a547f6d4c063f5501bdd07611fe5f | |
parent | 21c0be8496127df3f0ad652e582133148430cc41 (diff) | |
download | jquery-d46042e0500fb8241bf5ba012dfc779b535aa5fe.tar.gz jquery-d46042e0500fb8241bf5ba012dfc779b535aa5fe.zip |
Fix live mouseenter and mouseleave binding so they can be activated by triggers. Fixes #6514.
-rw-r--r-- | src/event.js | 2 | ||||
-rw-r--r-- | test/unit/event.js | 21 |
2 files changed, 20 insertions, 3 deletions
diff --git a/src/event.js b/src/event.js index 32d51d054..7ee4a3000 100644 --- a/src/event.js +++ b/src/event.js @@ -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; diff --git a/test/unit/event.js b/test/unit/event.js index a1aee191f..487388c4d 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -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"]); |