From 0ec71ac707fc3edce6ee67a54da6c779164812f4 Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Wed, 7 Sep 2011 22:49:32 -0400 Subject: [PATCH] Fix the special event handler for mouseover/out events. And use the /dist version of jquery.js, willya? --- src/event.js | 4 +++- test/hovertest.html | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/event.js b/src/event.js index 2b05d9a64..fc43ed1ae 100644 --- a/src/event.js +++ b/src/event.js @@ -717,11 +717,13 @@ jQuery.each({ selector = handleObj.selector, oldType, ret; + // NB: No relatedTarget if the mouse left/entered the browser window if ( selector && related ) { // Delegated event; find the real relatedTarget related = jQuery( related ).closest( selector )[0]; } - if ( !related || related !== target && !jQuery.contains( target, related ) ) { + // For mouseover/out, contains isn't needed; handle() already determined it's the right target + if ( !related || handleObj.origType === event.type || (related !== target && !jQuery.contains( target, related )) ) { oldType = event.type; event.type = handleObj.origType; ret = handleObj.handler.apply( this, arguments ); diff --git a/test/hovertest.html b/test/hovertest.html index 2c7267408..4c101ec00 100644 --- a/test/hovertest.html +++ b/test/hovertest.html @@ -1,7 +1,7 @@ Hover tests - +