Commit a9b81d75 authored by Gilmore Davidson's avatar Gilmore Davidson Committed by John Resig

Added check for live mouseenter/mouseleave events if bound to nested elements...

Added check for live mouseenter/mouseleave events if bound to nested elements with the same selector. Fixes #5884.
parent adef5c35
...@@ -1137,6 +1137,11 @@ function liveHandler( event ) { ...@@ -1137,6 +1137,11 @@ function liveHandler( event ) {
if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) { if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) {
event.type = handleObj.preType; event.type = handleObj.preType;
related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0]; 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 ) { if ( !related || related !== elem ) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment