Skip to content

A minimalistic HTML document manipulation and traversal javascript library using a jQuery-like syntax.

Notifications You must be signed in to change notification settings

ernestmarcinko/domini

Repository files navigation

DoMini · npm npm PRs Welcome

A minimalistic HTML document manipulation and traversal tool. Syntactically indentical to jQuery, but much smaller with only the essential features.

Check out the documentation for all the features.

Installation

Use npm or yarn to install DoMini with a single command

# with npm
npm i domini --save-dev

# with yarn
yarn add domini

In code

Complete library:

import DoMini from domini;

DoMini(function($){
    //.. do your thing
});

Core and optional modules:

import "domini/dist/domini-core";
import "domini/dist/domini-animate";
import "domini/dist/domini-highlight";
import "domini/dist/domini-serialize";
import "domini/dist/domini-viewport";
import "domini/dist/domini-xhttp";

DoMini(function($){
    //.. do your thing
});

Via CDN

If you prefer a build, use the CDN version (all features)

<script src="https://unpkg.com/domini@latest/dist/domini.js"></script>

..or individually (core + modules):

<script src="https://unpkg.com/domini@latest/dist/domini-core.js"></script>

// You can optionally load more modules after the core if you need them:
<script src="https://unpkg.com/domini@latest/dist/domini-animate.js"></script>
<script src="https://unpkg.com/domini@latest/dist/domini-highlight.js"></script>
<script src="https://unpkg.com/domini@latest/dist/domini-serialize.js"></script>
<script src="https://unpkg.com/domini@latest/dist/domini-xhttp.js"></script>

Sample Usage

DoMini loads itself to the DoMini variable in the global namespace.

// Similarly to jQuery
DoMini('#selector').text('Hi!');

// If you prefer $
const $ = DoMini;
$('#selector').text('Hi!');

// Or much better in a scope
(function($){
    $('#selector').text('Hi!');
})(DoMini);

// Fires on DOMContentLoaded or immediately if DOMContentLoaded was fired
DoMini(function($){ 
    $('#selector').text('Hi!');
});