dom2

    0.2.13 • Public • Published

    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 Chrome All
    Edge Edge All
    Safari Safari 3.0
    Firefox Firefox 2.0
    IE Internet Explorer 6.0
    Chrome Opera 9.2
    Chrome Android 2.1
    Chrome iOS 4.0

    Install

    Install via NPM:

    npm install dom2 --save-dev

    Usage

    Include dom.js as a script tag in your HTML file:

    <script src="path/to/dom.js"></script>
    <script>
      // window.Dom is available here
    </script> 

    Also you can use it as a ES6 module

    import Dom from 'dom2'
     
    // Now you can use Dom variable to access the API

    Or as a CommonJS module:

    var Dom = require('dom2');
     
    // Now you can use Dom variable to access the API

    Or as an AMD module:

    define(['dom2'], function (Dom) {
      // Now you can use Dom variable to access the API
    });

    API

    Dom.Class

    .add()

    .addSuffix()

    .contains()

    .getAll()

    .remove()

    .removeSuffix()

    .toggle()

    Dom.Event

    .add()

    .remove()

    Keywords

    none

    Install

    npm i dom2

    DownloadsWeekly Downloads

    60

    Version

    0.2.13

    License

    none

    Last publish

    Collaborators

    • dmitryshimkin