Added check for live mouseenter/mouseleave events if bound to nested elements with the same selector. Fixes #5884.
This commit is contained in:
parent
adef5c3550
commit
a9b81d759a
|
@ -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 ) {
|
||||||
|
|
Loading…
Reference in a new issue