Fix the special event handler for mouseover/out events.

And use the /dist version of jquery.js, willya?
This commit is contained in:
Dave Methvin 2011-09-07 22:49:32 -04:00 committed by timmywil
parent 8ba5010ac2
commit 0ec71ac707
2 changed files with 4 additions and 2 deletions

View File

@ -717,11 +717,13 @@ jQuery.each({
selector = handleObj.selector, selector = handleObj.selector,
oldType, ret; oldType, ret;
// NB: No relatedTarget if the mouse left/entered the browser window
if ( selector && related ) { if ( selector && related ) {
// Delegated event; find the real relatedTarget // Delegated event; find the real relatedTarget
related = jQuery( related ).closest( selector )[0]; 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; oldType = event.type;
event.type = handleObj.origType; event.type = handleObj.origType;
ret = handleObj.handler.apply( this, arguments ); ret = handleObj.handler.apply( this, arguments );

View File

@ -1,7 +1,7 @@
<html> <html>
<head> <head>
<title>Hover tests</title> <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> <style>
/* Remove body dimensions so we can test enter/leave to surrounding browser chrome */ /* Remove body dimensions so we can test enter/leave to surrounding browser chrome */
body, html { body, html {