Bug Tracker

Opened 11 years ago

Closed 11 years ago

Last modified 8 years ago

#3286 closed bug (fixed)

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

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 (1)

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

Download all attachments as: .zip

Change History (13)

comment:1 Changed 11 years ago by flesler

Cc: computerkidt flesler added
Component: coreevent
Keywords: iframe added
Priority: criticalmajor

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 11 years ago by flesler

need: PatchTest Case

comment:3 Changed 11 years ago by computerkidt

I'll code one up today and post the link

comment:4 Changed 11 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 11 years ago by computerkidt

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

comment:6 Changed 11 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 11 years ago by Artur

Attachment: jquery-1.2.6.js.diff added

fix

comment:7 Changed 11 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 11 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 11 years ago by computerkidt

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

comment:10 Changed 11 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 11 years ago by brandon

Milestone: 1.31.3.3
Owner: set to brandon

see also #4600 for another test case for this bug

comment:13 Changed 11 years ago by brandon

Resolution: fixed
Status: newclosed

Fixed in r6341

Note: See TracTickets for help on using tickets.