based on:
- https://github.com/kriskowal/es5-shim
- https://github.com/paulmillr/es6-shim
- https://github.com/Raynos/DOM-shim
Status: Stable Beta
- Simple Demo Try it in IE7 (or in IE6 ¬_¬)! And take a look at the source
- Complex Demo Not working in IE6 due lack of CSS
- Normalizing the JS and DOM across all browsers
- Less code (eg less closures, reusable functions) & file size
- IE6+ support
- Include all we need from ES5, ES6 and DOM shim in one file
- Powerful customisation
- Add methods such [add/remove]EventListener, querySelector[All], setSelectionRange, etc in IE6+
- Add Element/Node properties such classList, children, [first/last]ElementChild, reversed, control, labels, etc in IE6+
- Add methods such insertAdjacentHTML (old FF), stopImmediatePropagation (Opera < 12) and properties reversed, control, labels, etc in W3C browsers
- Add ES5/6 methods in all browsers
- Add DOM4 methods append, prepend, after, before, replace, remove, match in all browsers
- Provide bugs fixing for DOM and ES in IE, Opera, Chrome, FF
- and more
- For W3C browsers: ~8KiB gziped
- For IE8: ~16KiB gziped
- For IE6/7: ~18KiB gziped
- This lib is not about performance in IE < 9
- The a.ielt8.htc requests should respond with the mime type "text/x-component"
- That's all cautions
-
For modern browsers: Add main script in
head
section<script src="a.js"></script>
-
For IE8 support:
-
First[!] add
a.ie8.js
inhead
section<!--[if IE 8]> <script src="a.ie8.js"></script> <![endif]-->
-
Add
a.js
inhead
section<script src="a.js"></script>
- For IE6 and IE7, and IE8 support:
-
Add
a.ie8.js
anda.ielt8.js
,a.js
inhead
section<!--[if lt IE 8]> <script src="a.ielt8.js"></script> <![endif]--> <!--[if IE 8]> <script src="a.ie8.js"></script> <![endif]--> <script src="a.js"></script>
-
Put
a.ielt8.htc
to the root of your site
(pseudocode)
IF __GCC__INCLUDE_EXTRAS__ == false -> Broken Object.defineProperty and Object.defineProperties will be deleted
IF __GCC__INCLUDE_EXTRAS__ == true ->
- Exporting these objects to global (window)
- browser
- DOMStringCollection
- XHR from https://github.com/Raynos/xhr with customisations
- Extending objects
- Object.append(object, donor, [donor2, ...])
- Object.extend(object, donor, [donor2, ...]) (Object.append with overwrite exists properties)
- Object.inherits(Child, Parent)
- Array.prototype.unique()
- String.random(length)
Note: if you don't need Extras set GCC flag __GCC__INCLUDE_EXTRAS__ to false in a.js and recompile a.js using Google Closure Compiler (GCC online)
In addition to __GCC__INCLUDE_EXTRAS__ GCC flag there are a bunch of over flags to enable/disable ES5/6 and DOM3/4 shims in a.js file. After set flags you need to recompile a.js using Google Closure Compiler (GCC online)
If GCC flag __GCC__IS_DEBUG__ == true -> Console fix from https://github.com/theshock/console-cap/blob/master/console.js
IE requires that the .htc behavior file must be in the same domain as the HTML page which uses it. If you try to load the behavior from a different domain, you will get an "Access Denied" error. Note that the domain must be exactly the same; that means that http://www.foo.com is a different domain than http://foo.com. http://css3pie.com/documentation/known-issues/#x-domain
Russian instruction in extra/SameDomainLimitation.SOLVE_RUS.odt
http://jsperf.com/es5-dom-shim-test
- Lack of test cases
- Same-domain limitation (can be solve only on server) for IE < 8
- Incompatibility with http://code.google.com/p/ie7-js/ [working on it]
- Tests
- http://dvcs.w3.org/hg/url/raw-file/tip/Overview.html (https://gist.github.com/1384398 & https://gist.github.com/1235332)
MIT