I am developing a library like jQuery but with more minimal features and size called AmiraJS.
It's released version 1.0.2 on github with the most commonly used APIs like innerHTML, value property, setAttribute, removeAttibute, show and hide elements.
AmiraJS reinvent the jquery but with only had a compressed size of 0.4kb, this is the reason why it's lightweight!
PoC : https://github.com/fauzan121002/amirajs/issues/1
AmiraJS APIs
insert
You can insert both value or text in single function.
$(".amira").insert("Hello World");
empty
You can empty both value or text in single function.
$(".amira").empty();
setAttr
You can set elements attribute by using setAttr
function.
$(".amira").setAttr("id", "11");
Also supports fluent design
$(".amira").setAttr("id", "11").setAttr("style", "color: red;");
removeAttr
You can remove elements attribute by using removeAttr
function.
$(".amira").removeAttr("id");
show
You can show elements by using show
function.
$(".amira").show();
hide
You can hide elements by using hide
function.
$(".amira").hide();
jQuery is more complete in terms of features, but if you want to use a dom manipulation library with minimal size and features, AmiraJS could help.
Github Link : https://github.com/fauzan121002/amirajs
Discussion (2)
I love tiny libraries like this, have a ❤🦄
I hope the below gives you some inspiration, as if you want tiny and powerful (with support for IE!) my modified version of ki.js is pretty sweet:-
This gives you:
$('button').on('click', someAction);
for event listeners (and.off
to remove them)$('div').each(function (elem, i) {
to iterate over items$(function () {
for document readyAll for 150 bytes gzipped!
And for extra features:-
That gives us
addClass removeClass toggleClass and hasClass
.And if you want the kitchen sink:-
Although that would be 750 bytes gzipped so it might be a little large!
this library is even smaller, the open source world is really beautiful!