I stumbled across this project: https://github.com/termi/ES5-DOM-SHIM which provides almost full ES5 support in all browsers including old IEs.
I've been using it in pure JS projects, but now I have to include jquery/mootools/prototype in a project (that uses High Charts).
Even just including the jquery script causes errors to be thrown in IE8 along with this shim. How can I keep the best of both worlds?
My document head looks like this:
<!--[if lte IE 8]>
<script src="/js/a.ie8.js"></script>
<![endif]-->
<script src="/js/a.js"></script>
<script src="/js/jquery.1.8.2.js"></script>
<script src="/js/main.js"></script>
Make sure you're using the correct html structure, e.g.:
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<!--[if lte IE 8]>
<script src="a.ie8.js"></script>
<![endif]-->
<script src="a.js"></script>
<script src="jquery.1.8.2.js"></script>
<script src="main.js"></script>
</head>
<body>
</body>
When I tested your structure (without doctype) I was also getting an error in IE.
This is a late answer, and probably it doesn't address your main issue. So at the risk of getting downvoted...
As far I can tell from the Github project ES5-DOM-SHIM not only provides shim for ES5 features but also tries to shim DOM features that are not available on IE. This is very useful if you wish to program directly with the DOM API.
jQuery also provides a compatibility layer that does feature check in order to fill implementation gaps (so you don't need a DOM polyfill if your code only uses jQuery).
Mixing both doesn't seem to be a good idea because:
If you want JavaScript polyfills only, try with https://github.com/kriskowal/es5-shim (note ES5-DOM-SHIM is based on it)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With