Side navigation
Ticket #6514: live-event-trigger-fix.patch
File live-event-trigger-fix.patch, 1.4 KB (added by brianloveswords, May 02, 2010 06:51PM UTC)
QUnit test and fix for mouseenter and mouseleave not being triggerable when bound by live.
diff --git a/src/event.js b/src/event.js
index 45f2202..1d573a2 100644
--- a/src/event.js
+++ b/src/event.js
@@ -964,7 +964,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 9e1ac89..d7ef375 100644
--- a/test/unit/event.js
+++ b/test/unit/event.js
@@ -588,7 +588,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" );
@@ -605,7 +605,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"]);
Download in other formats:
Original Format
File live-event-trigger-fix.patch, 1.4 KB (added by brianloveswords, May 02, 2010 06:51PM UTC)
QUnit test and fix for mouseenter and mouseleave not being triggerable when bound by live.
diff --git a/src/event.js b/src/event.js
index 45f2202..1d573a2 100644
--- a/src/event.js
+++ b/src/event.js
@@ -964,7 +964,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 9e1ac89..d7ef375 100644
--- a/test/unit/event.js
+++ b/test/unit/event.js
@@ -588,7 +588,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" );
@@ -605,7 +605,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"]);