The concept behind the MakeIE8SuckLess library is just to fill in gaps where IE8 slightly differs from IE9+. For instance getElementsByClassName is missing so I’ve done a very simple implementation of it (not performance optimised). Another example is that I’ve got a method MakeIE8SuckLess.ByFixingMyMouseEvent(event) where you pass in a mouse event object and it will add missing properties like pageX and pageY and missing methods like stopPropagation() and preventDefault().
My intention is not to make the library complete straight away, but as I identify gaps while I’m working on this new project, I’ll add to it and hopefully others may find it of use.
Include it in your page as per usual –
Then all that remains to be done is to initialise it (I’m Australian and we spell it with an “s” but if it bugs you at all you change it in your copy of the code 🙂 ).
- If you pass in an undefined/null reference, this method will go off and pull the event object from window.event as this is where the event information is stored in IE8, not passed into the called function
pageYproperties are added to the event object according to how Microsoft describes it in their documentation at https://msdn.microsoft.com/en-us/library/ie/ff974655%28v=vs.85%29.aspx and https://msdn.microsoft.com/en-us/library/ie/ff974656(v=vs.85).aspx
stopPropagation()method is added to the event object according to how Microsoft describes it in their documentation at https://msdn.microsoft.com/en-us/library/ie/ff975462%28v=vs.85%29.aspx
preventDefault()method is added to the event object according to how Microsoft describes it in their documentation at https://msdn.microsoft.com/en-us/library/ie/ff975460(v=vs.85).aspx
addEventListener()is added to the element and will just make a call to
attachEvent()and prefix the declared event with “on” – this isn’t perfect but for most scenarios should work fine
removeEventListener()is added to the element and will just make a call to
detachEvent()and prefix the declared event with “on” – again, this isn’t perfect but for most scenarios should work fine like