DoMini
A minimalistic HTML document manipulation and traversal javascript library
npm install domini --save-dev
..or directly:
<script src="https://unpkg.com/domini@latest/dist/domini.js"></script>
Node Manipulation
// Find a node and change class & CSS
$('div').find('button').addClass('myButton').css({
"marginLeft": "10px",
"opacity": 0.5
});
// Remove a node && add new
if ( $('body').hasClass('rtl') ) {
$('button').last().remove(); // remove last button
$('body').append('<div>'); // add a new div to body
};
Ajax & Event listeners
$('button').on('click', function(){
$.fn.ajax({
url: "http://localhost:3000",
data: {
options: $('form').serialize();
},
success: function(response){
console.log(response);
}
});
});
Small & Simple
DoMini is a tiny ES6 javascript library with the powerful jQuery
syntax. Only ~15kB in size, minimal overhead to your project.
Many Features
By default the animate
, highlight
, xhttp (ajax)
, serialize
, viewport
modules are included.
Open Source
You can download, modify and even contribute to the code if you want to!
Why DoMini?
DoMini aims at using the latest ES6 features available for modern web browsers - reducing the output file size significantly. The subset of features suits projects where older browser compatibility is not an issue and some basic DOM features are sufficient.
DoMini core syntax is mostly identical to jQuery with reduced featureset. Using the well known functions like .each()
.data()
.css()
etc.. are all present in DoMini as well, so migrating existing projects is less painful.
How does DoMini compare to jQuery?
DoMini is not a replacement for jQuery by any means. jQuery is far superior in features and browser compatibility. DoMini only implements the most commonly used subset of functions to make DOM manipulation easier.