From a9b81d759af3a4574a42ca1de93be1247f7953a2 Mon Sep 17 00:00:00 2001 From: Gilmore Davidson Date: Sun, 17 Apr 2011 10:34:38 -0700 Subject: Added check for live mouseenter/mouseleave events if bound to nested elements with the same selector. Fixes #5884. --- src/event.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/event.js') 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 ) { -- cgit v1.2.3