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
mouseover
is followed by amouseout
, even while the mouse is still over the text field. - When attempting to read the
mouseout
event.relatedTarget.nodeName
property, an exception is thrown. - Another
mouseover
event is fired, this time withevent.relatedTarget
set 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.relatedTarget
set to the same element as the element on which the event is registered. - Attempt to access
event.relatedTarget.nodeName
and, 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