]> source.dussan.org Git - jquery.git/commitdiff
Fix the special event handler for mouseover/out events.
authorDave Methvin <dave.methvin@gmail.com>
Thu, 8 Sep 2011 02:49:32 +0000 (22:49 -0400)
committertimmywil <timmywillisn@gmail.com>
Mon, 19 Sep 2011 19:42:31 +0000 (15:42 -0400)
And use the /dist version of jquery.js, willya?

src/event.js
test/hovertest.html

index 2b05d9a64f8aa1a6713e60edab44739bcbe760c2..fc43ed1ae268cf1bcb5034cabfce3cf1531c5992 100644 (file)
@@ -717,11 +717,13 @@ jQuery.each({
                                selector = handleObj.selector,
                                oldType, ret;
 
+                       // NB: No relatedTarget if the mouse left/entered the browser window
                        if ( selector && related ) {
                                // Delegated event; find the real relatedTarget
                                related = jQuery( related ).closest( selector )[0];
                        }
-                       if ( !related || related !== target && !jQuery.contains( target, related ) ) {
+                       // For mouseover/out, contains isn't needed; handle() already determined it's the right target
+                       if ( !related || handleObj.origType === event.type || (related !== target && !jQuery.contains( target, related )) ) {
                                oldType = event.type;
                                event.type = handleObj.origType;
                                ret = handleObj.handler.apply( this, arguments );
index 2c7267408016408c85f0644417fc9eb630de5295..4c101ec00dc37fbf05ed3248c892ab0373cacd01 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <head>
 <title>Hover tests</title>
-<script src="http://code.jquery.com/jquery-1.6.2.js" type='text/javascript'></script>
+<script src="../dist/jquery.js" type='text/javascript'></script>
 <style>
 /* Remove body dimensions so we can test enter/leave to surrounding browser chrome */
 body, html {