Bug Tracker

Modify

Ticket #42 (closed bug: fixed)

Opened 7 years ago

Last modified 14 months ago

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:
Blocking: Blocked by:

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

jquery-safari-hover.diff Download (600 bytes) - added by adrian@… 7 years ago.
patch to jQuery 1.0a fixes bug (tested in Safari 2.0.4 and Firefox 1.5.0.4)
jquery-safari-hover.2.diff Download (600 bytes) - added by adrian@… 7 years ago.
patch to jQuery 1.0a fixes bug under Safari (tested in Safari 2.0.4 and Firefox 1.5.0.4)

Change History

comment:1 Changed 7 years ago by tfs AT excit

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

comment:2 Changed 7 years ago by john

  • Version set to 1.0
  • Milestone set to 1.0

Changed 7 years ago by adrian@…

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

Changed 7 years ago by adrian@…

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

comment:3 Changed 7 years ago by Adrian Samps

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

comment:4 Changed 7 years ago by john

  • Status changed from new to closed
  • Resolution set to fixed

Fixed in SVN.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.