EventShim adds support for addEventListener(), removeEventListener(), and standard Event object properties to IE8's event model.
To write standards-based event code now in IE8 without using a library such as jQuery, MooTools, etc.
The right way: by modifying the DispEventObj's prototype, as well as the HTMLDocument and Element DOM interface prototypes. This approach allows you to "write once."
EventShim is easy to implement.
$ git clone [email protected]:jwmcpeak/EventShim
<script src="eventShim.js"></script>
The goal of EventShim is to make writing cross-browser event code painless and transparent. Naturally, it is impossible to replicate 100% of the DOM3 Event API in IE8, but the following lists the properties and methods added to the DispEventObj interface.
- bubbles
- defaultPrevented
- relatedTarget
- target
- preventDefault()
- stopPropagation()
EventShim also adds addEventListener() and removeEventListener() to the following objects and/or interfaces:
- window
- HTMLDocument
- Element
This covers all use-cases.
- There is no capture. It's IE, remember?