]> source.dussan.org Git - jquery.git/commitdiff
Added check for live mouseenter/mouseleave events if bound to nested elements with...
authorGilmore Davidson <gilmoreorless@gmail.com>
Sun, 17 Apr 2011 17:34:38 +0000 (10:34 -0700)
committerJohn Resig <jeresig@gmail.com>
Sun, 17 Apr 2011 17:34:38 +0000 (10:34 -0700)
src/event.js

index 92fe0cb3d078bc903eb74a5bf409222e71ddd67d..32d51d0544e330c6c5a0b9f77ee74a03a7862e10 100644 (file)
@@ -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 ) {