IE8 EventTarget polyfill
Code at GitHub
Test #1: normal listener
click me
Listeners are added using a normal element.addEventListener().
Test #2: adding and removing
click me
Listeners are removed using a normal element.removeEventListener().
Test #3: event properties
click me
Event object is normalized by adding "timeStamp", "target", "currentTarget", "pageX", "pageY", "eventPhase" and "relatedTarget".
Test #4: stopping propagation
click me
click me too
Event object has stopPropagation().
Test #5: preventing default action
click me, url shall change
click me, url shall not change
Event object has preventDefault().
Test #6: target vs. currentTarget
click me
Event's "currentTarget" corresponds to the listener location. The "target" property is the event origin.
Test #7: relatedTarget
move here
and here
Mouse over/out events have a "relatedTarget" property.
Test #8: dispatching
click me
You can dispatch a custom-made mouse event using dispatchEvent().
Test #9: capture
click me
click me too
Event object has stopPropagation().