Dom
Dom is a lightweight library to make cross browser work with DOM easier.
The library's core contains three modules:
- Dom.Class provides methods to work with HTML elements' class names.
- Dom.Element provides methods to work with HTML elements.
- Dom.Event provides methods to woks with HTML events.
Also the core contains helpers Dom.closest, Dom.matches, and Dom.contains.
The library is designed for using on projects where performance matters.
Table of content
Key features
- Works everywhere. See Browser support
- Best performance: 5–10 times faster than jQuery, almost equals to direct calls of DOM API
- Small footprint: ~3.5 KB (minified and gzipped)
- No dependencies, no need polyfills
- 100 % test coverage
Browser support
Browser | Version |
---|---|
Chrome | All |
Edge | All |
Safari | 3.0 |
Firefox | 2.0 |
Internet Explorer | 6.0 |
Opera | 9.2 |
Android | 2.1 |
iOS | 4.0 |
Install
Install via NPM:
npm install dom2 --save-dev
Usage
Include dom.js
as a script tag in your HTML file:
Also you can use it as a ES6 module
// Now you can use Dom variable to access the API
Or as a CommonJS module:
var Dom = ; // Now you can use Dom variable to access the API
Or as an AMD module:
;