JavaScript Library Addiction

Hi. I’m Chris and I have a JavaScript library addiction. I’m guessing I’m not the only.

As I was redesigning JibberBook.com, I was trying to locate a small library to create a tab script. The minimum stuff I needed for Mootools amounted to around 32kb YUI compressed (I’m not too happy about Mootools anymore), and jQuery is 29kb packed. I thought about using DOM Assistant, but after looking at the code, decided it was too much. All I needed to do was select elements by class and id, attach an event, and change some styles and classes. Libraries were obviously overkill.

So I ended up just searching for a class selector function and an add event function and wrote everything else myself. Sure I had to search for some cross-browser techniques a couple times and had to do a bit more testing, but it was definitely worth it. The script size is under 2kb, and it’s even unobtrusive.

The moral of this story: Toss off your floaties and dive in, and don’t force your visitors to download 100kb javascript files because you can’t program.

One Response to “JavaScript Library Addiction”

  1. Olivier

    Hi, my name is olivier and I also have an addiction to mootools, and recently I ran into the same problem for a small client site: ending with a 40kb file just to ajaxify a form. I had been using mootools for so long I didn’t even remember how to make an ajax request.
    I took a look at the source on jibberbook.com, and the addEvent function is great.
    However, in the event function, i think that if you make it return false at the end, it will stop the event, no need to check for preventDefault or returnValue

Leave a Reply