aboutsummaryrefslogtreecommitdiffstats
path: root/src/event.js
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2011-05-10 11:49:32 -0400
committerJohn Resig <jeresig@gmail.com>2011-05-10 11:49:32 -0400
commit419b5e5e2a0d376e71c3f37bf9a3d96f3b4a67f2 (patch)
treee7c517e8df3ea41e862ed977676c7a3c59ae696e /src/event.js
parent521ae562daa8f95def8872a55a260e9bdbc40d8b (diff)
downloadjquery-419b5e5e2a0d376e71c3f37bf9a3d96f3b4a67f2.tar.gz
jquery-419b5e5e2a0d376e71c3f37bf9a3d96f3b4a67f2.zip
Make sure that mouseenter/mouseleave fire on the correct element when doing delegation. Fixes #9069.
Diffstat (limited to 'src/event.js')
-rw-r--r--src/event.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/event.js b/src/event.js
index 05e79d358..2bed09046 100644
--- a/src/event.js
+++ b/src/event.js
@@ -654,6 +654,9 @@ var withinElement = function( event ) {
// Check if mouse(over|out) are still within the same parent element
var parent = event.relatedTarget;
+ // set the correct event type
+ event.type = event.data;
+
// Firefox sometimes assigns relatedTarget a XUL element
// which we cannot access the parentNode property of
try {
@@ -663,15 +666,13 @@ var withinElement = function( event ) {
if ( parent && parent !== document && !parent.parentNode ) {
return;
}
+
// Traverse up the tree
while ( parent && parent !== this ) {
parent = parent.parentNode;
}
if ( parent !== this ) {
- // set the correct event type
- event.type = event.data;
-
// handle event if we actually just moused on to a non sub-element
jQuery.event.handle.apply( this, arguments );
}