DEPRICATION WARNING: the functionality in this script has been superceeded / trivialised by updated web standards.
A library of useful polyfills to ease working with HTML5 in legacy environments.
This include can be added to the header or placed inline before the script is invoked.
<script src="js/polyfills.js"></script>
Or use Require.js.
requirejs([
'js/polyfills.js'
], function(polyfills) {
...
});
Or use imported as a component in existing projects.
@import {polyfills} from "js/polyfills.js');
polyfills.html5();
Add support for HTML5 elements in Internet Explorer 8 and lower.
polyfills.arrayIndexOf();
Adds support for array.indexOf.
polyfills.querySelectorAll();
Adds support for document.querySelectorAll (1).
polyfills.addEventListener();
Adds support for element.addEventListener, element.removeEventListener and element.dispatchEvent (2).
polyfills.consoleLog();
Adds support for console.log.
polyfills.objectCreate();
Adds support for object.create (3).
polyfills.stringTrim();
Adds support for string.trim, string.ltrim, string.rtrim and string.fulltrim (4).
polyfills.localStorage();
Adds support for localStorage.getItem, localStorage.key, localStorage.setItem, localStorage.length, localStorage.removeItem (5).
- Connolley, Paul. "IE7 querySelectorAll polyfill", https://gist.github.com/connrs/2724353
- Neal, Jonathan. "Polyfill the EventListener interface in IE8", https://gist.github.com/jonathantneal/3748027
- Gasparini, Ryan. "HTML5 API Polyfills", https://gist.github.com/rxgx/1597825
- Perelman, Eli. "String.prototype.trim polyfill for 140byt.es", https://gist.github.com/eliperelman/1035982
- Mozilla Developer Network. "DOM Storage guide", https://developer.mozilla.org/en/docs/Web/Guide/API/DOM/Storage
This work is licensed under a MIT License. The latest version of this and other scripts by the same author can be found on Github.