Bug Tracker

Modify

Ticket #3286 (closed bug: fixed)

Opened 5 years ago

Last modified 14 months ago

Hover Glitch/Bug

Reported by: computerkidt Owned by: brandon
Priority: major Milestone: 1.4
Component: event Version: 1.2.6
Keywords: hover, iframe Cc: computerkidt, flesler
Blocking: Blocked by:

Description

.hover() when put in a frame that has a scroller bar always acts up like when you put your mouse in the hover area it activates but when you move the mouse out of the area thru the side with the scroller bar it will not deactivate. This bug is the same in jquery v1.2.3 and v1.2.6.

Attachments

jquery-1.2.6.js.diff Download (229 bytes) - added by Artur 5 years ago.
fix

Change History

comment:1 Changed 5 years ago by flesler

  • Cc computerkidt, flesler added
  • Keywords hover, iframe added; hover removed
  • Component changed from core to event
  • Priority changed from critical to major

Can you please provide a test case ? that is, a small html file with the minimum html/css/js necessary to reproduce the problem.

comment:2 Changed 5 years ago by flesler

  • need changed from Patch to Test Case

comment:3 Changed 5 years ago by computerkidt

I'll code one up today and post the link

comment:4 Changed 5 years ago by computerkidt

I made you a sample you can view the bug in a frame at:  http://www.armyoffate.com/hoverbug.php The actual coding is at  http://www.armyoffate.com/hoverbug2.php but you can only see the bug in action from the first link.

If you need anything else let me know. Also please let me know once you have a patch or fix for this because this is a huge problem on my site.

Thanks, Terrence

comment:5 Changed 5 years ago by computerkidt

Also I forgot to mention I found this bug on Firefox 2 & Firefox 3.

comment:6 Changed 5 years ago by computerkidt

I added a menu to the top frame so you can see how each jquery type & version does. It's seperate from the hoverbug2.php frame so it doesn't add any code to it.

Changed 5 years ago by Artur

fix

comment:7 Changed 5 years ago by Artur

solution : 2405c2405 < while ( parent && parent != elem ) try { parent = parent.parentNode; } catch(error) { parent = elem; } ---

while ( parent && parent != elem ) try { parent = parent.parentNode; } catch(error) { return false; }

end

in function :

Checks if an event happened on an element within another element Used in jQuery.event.special.mouseenter and mouseleave handlers var withinElement = function(event, elem) {

Check if mouse(over|out) are still within the same parent element var parent = event.relatedTarget; Traverse up the tree while ( parent && parent != elem ) try { parent = parent.parentNode; } catch(error) { parent = elem; } Return true if we actually just moused on to a sub-element return parent == elem;

};

when you move mouse outside the elem directly to slider ff puts xul element to event.relatedTarget. this causes exception on parent.parentNode (because you cannot access it) so the function returns that slider is inside elem. I'm not sure if this solution works in every case, but cannot find case in with it crashes.

cheers Artur

PS. sorry for bad English

comment:8 Changed 5 years ago by Artur

sorry for previous post :P

Solution :

2405c2405
< 	while ( parent && parent != elem ) try { parent = parent.parentNode; } catch(error) { parent = elem; }
---
> 	while ( parent && parent != elem ) try { parent = parent.parentNode; } catch(error) { return false; }

in function :

// Checks if an event happened on an element within another element
// Used in jQuery.event.special.mouseenter and mouseleave handlers
var withinElement = function(event, elem) {
	// Check if mouse(over|out) are still within the same parent element
	var parent = event.relatedTarget;
	// Traverse up the tree
	while ( parent && parent != elem ) try { parent = parent.parentNode; } catch(error) { parent = elem; }
	// Return true if we actually just moused on to a sub-element
	return parent == elem;
};

when you move mouse outside the elem directly to slider ff puts xul element to event.relatedTarget. this causes exception on parent.parentNode (because you cannot access it) so the function returns that slider is inside elem. I'm not sure if this solution works in every case, but I cannot find case in which it crashes.

cheers Artur

PS. sorry for bad English

comment:9 Changed 5 years ago by computerkidt

So how would I edit that into my script???

comment:10 Changed 5 years ago by Artur

just replace:

while ( parent && parent != elem ) try { parent = parent.parentNode; } catch(error) { parent = elem; }

with:

while ( parent && parent != elem ) try { parent = parent.parentNode; } catch(error) { return false; }


in your jquery-1.2.6.js script

comment:12 Changed 4 years ago by brandon

  • Owner set to brandon
  • Milestone changed from 1.3 to 1.3.3

see also #4600 for another test case for this bug

comment:13 Changed 4 years ago by brandon

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

Fixed in r6341

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.