Skip to main content

Bug Tracker

Side navigation

#42 closed bug (fixed)

Opened July 05, 2006 02:17PM UTC

Closed July 16, 2006 12:13AM UTC

Last modified March 15, 2012 02:10PM UTC

hover: mouseout function not working in Safari

Reported by: tfs7 AT excite DOT c Owned by:
Priority: major Milestone: 1.0
Component: event Version: 1.0
Keywords: hover Cc:
Blocked by: Blocking:
Description

Here is the function I have for doing a simple image rollover (for AJAX actions taking place on click that ultimately "deadens" the clicked link). Pre-1.0 versions of jQuery worked in Safari properly, but 1.0a has the mouseout function not working. FF mac, FF, and IE all work appropriately. (Related note: I've had some problems with toggle() at times in Safari at times with older versions of jQuery, which might help the debugging.)

$(foo).hover(function(){

var s = $(this).get(0).getAttribute("src");

if(s == "/images/up.gif")

$(this).set("src","/images/up_roll.gif");

},function(){

var s = $(this).get(0).getAttribute("src");

if(s == "/images/up_roll.gif")

$(this).set("src","/images/up.gif");

});

Attachments (2)
  • jquery-safari-hover.2.diff (0.6 KB) - added by adrian@radbox.org July 09, 2006 01:33AM UTC.

    patch to jQuery 1.0a fixes bug under Safari (tested in Safari 2.0.4 and Firefox 1.5.0.4)

  • jquery-safari-hover.diff (0.6 KB) - added by adrian@radbox.org July 09, 2006 01:32AM UTC.

    patch to jQuery 1.0a fixes bug (tested in Safari 2.0.4 and Firefox 1.5.0.4)

Change History (4)

Changed July 06, 2006 07:34PM UTC by tfs AT excit comment:1

Mouseover and mouseout on IE for same function above does not now either.

Changed July 08, 2006 05:29PM UTC by john comment:2

milestone: → 1.0
version: → 1.0

Changed July 09, 2006 01:37AM UTC by Adrian Samps comment:3

This somewhat awkward patch fixes the bug under Safari. I've tested it with Safari 2.0.4 and Firefox 1.5.0.4.

--- jquery-1.0a.js	2006-07-01 07:15:52.000000000 -0700
+++ jquery-1.0a-fixed.js	2006-07-08 18:23:16.000000000 -0700
@@ -878,7 +878,10 @@
 	// A private function for haandling mouse 'hovering'
 	function handleHover(e) {
 		// Check if mouse(over|out) are still within the same parent element
-		var p = e.fromElement || e.toElement || e.relatedTarget;
+		if (e.type == "mouseover")
+		    var p = e.fromElement || e.relatedTarget;
+		else
+		    var p = e.toElement || e.relatedTarget;
 		while ( p && p != this ) p = p.parentNode;
 		
 		// If we actually just moused on to a sub-element, ignore it

Changed July 16, 2006 12:13AM UTC by john comment:4

resolution: → fixed
status: newclosed

Fixed in SVN.