I have noticed that in Chrome and IE9, for onmouseout
events there is an event.toElement
property (so you can determine which element the mouse is
As of 2014, IE11 doesn't support toElement
, I looked through the event object and found target
to have the same data as toElement.
That is to say, if you click on a child element inside an element that this event triggered on, the child element will be the 'target' and stored in this attribute.
The element the event fired from is stored in the currentTarget
attribute.
Note, I've only tested this for ie 11 so older versions may not support this.
So to support firefox ie and chrome (and possibly others, a polyfill would be necessary, something like:
var target = e.toElement || e.relatedTarget || e.target || function () { throw "Failed to attach an event target!"; }
Where e
is the event