Skip to content

2.3KB JS Library with ajax, animation, dom manipulation, json encoding

vX was an old project which aimed to do lots of nifty things in the least code possible (3KB without gzip!), but among its goals, developer friendliness wasn’t present. So now, I made a new library, this one is 5KB before gzip, and supports most of what vX does, but with DOM manipulation as well, in a jquery-like manner, and animations with queuing and easing. The new library (which doesn’t yet have a name) aims to be really lightweight (which really doesn’t matter much), while being more developer friendly.

For example, I can select all elements with the class “test” using _.cls(“test”), and make them purple by doing _.cls(“test”).css(“color”,”purple”) similar to jQuery. I can do“yay”).load(“lib.js”) to load something using ajax. Creating elements is pretty easy too, say I want to load a random script, I can do _.create(“script”).attr(“src”,”url”).appendTo(_.tag(“body”)) and I can add events to something using _.tag(“button”).index(0).on(“click”,function(e){alert(“yay”)}).

Here’s a nice little demo of what it can do

I intended to post this back in March 7th, but I was working on a rewrite of the library, which would be a tiny bit larger but implement CSS-selectors and be easier to maintain.

Posted in vX JS.

Tagged with , , .

3 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. josep_ssv says

    Te sigo Admin, muy interesante
    Lo probaré.
    Gracias por estos pequeños e ingeniosos detalles.
    Hace tiempo que no se mueve el Forum

  2. David says

    I just found your vX library and I was actually thinking about using it for some upcoming projects. I know this is the age of DSL – but 1KB CSS/PHP/Javascript libraries are just plain cool. I wrote the MicroMVC framework because there is always some way to optimize code.

    Anyway, I’m going to go play with your new library now. Thanks for the work you put into this stuff.

  3. admin says

    Because jQuery already used the $. I made another library which is a more mature version of the as-of-yet-unnamed library which used the $. That one’s a lot nicer to look at as that one doesn’t get much prettier un-minified. Here’s the source:

    This is the library I was working on it has a jquery-type API with a tiny selectors engine. It was supposed to have an awesome compression engine which did all these insane optimizations, but I never finished it.

Some HTML is OK

or, reply to this post via trackback.