0.1.4 • Published 11 years ago
dom-shims v0.1.4
dom-shims
Complete and well-tested shims / polyfills for various DOM API's missing in not-so-modern browsers.
Installation
npm install --save dom-shimsApply all the shims by requiring the module without assignment:
require('dom-shims');Or apply specific shims:
require('dom-shims/shim/CustomEvent');
require('dom-shims/shim/Element.classList');
require('dom-shims/shim/Element.matches');Features
Event polyfills
- CustomEvent constructor
Element.prototype shims
- Element#classList1
- Element#length
- Element#add(tokens...)
- Element#contains(token)
- Element#item(token)
- Element#remove(tokens...)
- Element#toggle(token, force)
- Element#closest
- Element#matches2
NOTES:
Ensures all browsers have
classListsupport for SVG elements, multiple-argument support foraddandremove,force-argument support fortoggle, and correctlengthanditemvalues even when theclassvalue is mutated by means other thanclassList.Patches IE 9's implementation, which lacks support for Elements not attached to the
document.
Element mutation
DOM Level 4 mutation macros for:
parentNode:
- Element#append()
- Element#prepend()
childNode:
- Element#after()
- Element#before()
- Element#remove()
- Element#replace()
Other shims
Browser support
Intended support for:
- Chrome
- Firefox
- IE9+
- Safari 6+
- Android 4+
- Safari iOS 5.1+
- Opera
Acknowledgements
Thanks to the following libraries for inspiration, ideas, and workarounds:
