Skip to content
Complete and well-tested shims / polyfills for various DOM API's missing in not-so-modern browsers
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
shim
test
.gitignore
.travis.yml
CHANGELOG.md
LICENSE.md
README.md
index.js
karma.conf.js
package.json

README.md

dom-shims

Build Status

Sauce Test Status

Complete and well-tested shims / polyfills for various DOM API's missing in not-so-modern browsers.

Installation

npm install --save dom-shims

Apply 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

Element.prototype shims

NOTES:

  1. Ensures all browsers have classList support for SVG elements, multiple-argument support for add and remove, force-argument support for toggle, and correct length and item values even when the class value is mutated by means other than classList.

  2. 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:

You can’t perform that action at this time.