diff options
author | Gilmore Davidson <gilmoreorless@gmail.com> | 2011-04-17 10:34:38 -0700 |
---|---|---|
committer | John Resig <jeresig@gmail.com> | 2011-04-17 10:34:38 -0700 |
commit | a9b81d759af3a4574a42ca1de93be1247f7953a2 (patch) | |
tree | 8c856a355bbbc9e09c5d5730721655898c9675f7 /src/event.js | |
parent | adef5c3550141960089e2634619ef028931f4765 (diff) | |
download | jquery-a9b81d759af3a4574a42ca1de93be1247f7953a2.tar.gz jquery-a9b81d759af3a4574a42ca1de93be1247f7953a2.zip |
Added check for live mouseenter/mouseleave events if bound to nested elements with the same selector. Fixes #5884.
Diffstat (limited to 'src/event.js')
-rw-r--r-- | src/event.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/event.js b/src/event.js index 92fe0cb3d..32d51d054 100644 --- a/src/event.js +++ b/src/event.js @@ -1137,6 +1137,11 @@ function liveHandler( event ) { if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) { event.type = handleObj.preType; related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0]; + + // Make sure not to accidentally match a child element with the same selector + if ( related && jQuery.contains( elem, related ) ) { + related = elem; + } } if ( !related || related !== elem ) { |