Mozilla Mouse Bug
Reported 1 November 2005 to Quirks Mode.
Description
The above text input element has event listeners registered for both "mouseover" and "mouseout". One should see pairs of mouseover/mouseout events when the mouse enters/exits the text field (as one sees in IE 6). On Firefox 1.0.7, several strange things occur:
- A normal
mouseoveris followed by amouseout, even while the mouse is still over the text field. - When attempting to read the
mouseoutevent.relatedTarget.nodeNameproperty, an exception is thrown. - Another
mouseoverevent is fired, this time withevent.relatedTargetset to the same element as the element on which the event is registered. - The reverse sequence occurs when the mouse leaves the element.
Workaround
In order to respond to simply mouseover/mouseout events, one must perform both of the following:
- Ignore all mouseover/mouseout events that have
event.relatedTargetset to the same element as the element on which the event is registered. - Attempt to access
event.relatedTarget.nodeNameand, if an exception is thrown, ignore the event.
This workaround is compatible with IE 6, as that browser does not send the extraneous events in the first place. This workaround is forward compatible only if Mozilla fixes the extraneous event bug when it fixes the event.relatedTarget.nodeName access bug.
Copyright © 2005 Garret Wilson