Friday, March 2nd, 2007

ADLib: Another DHTML Library

Category: JavaScript, Library

Bart Melton has a sense of humour, and came out with ADLib: Another DHTML Library.

The highlights are:

  1. XHR (of course)
  2. Behaviors (custom written, but same principle, so I used the same name)
  3. Event management
  4. Effects creation engine
  5. Hashes
  6. Array and string extensions
  7. Functions for basic styling (setStyle, addClass etc)
  8. Several DOM searching techniques ($, $c, $a, $css, $t)
  9. A few widgets
  10. Lots of random things that may or may not be useful.

We had to ask Bart: “another library? really? why would we want that?” and he came back with a nice response:

The library has been an evolving tool I have used for ~10 years now. It started as the basic_dhtml.js portion of the current library and has grown. With the recent trends in ajax and effects libraries and so forth, I decided to update it to a more industrial strength library and release it in the wild. I have had very little formal programming training, so for me, learning has always been through doing. As such, I don’t use other people’s libraries, I see a neat concept and figure out how to do it myself. First and formost, it is a tool for me to use and it has been a great learning experience in writing it that has taken my programming ability to the next level. Now that I have it, my on the job coding has become much easier, faster, and more efficient.

As to the name, it originally started out as just a DHTML library (just style getters/setters) . It is also a late comer to the party, thus the another. Lastly, I am a lazy typer and when I was deciding whether to namespace the entire library or not (I settled on not), I didn’t want something that would be long and add unnecessary file size. To be honest, I couldn’t think of anything really catchy.

As to why others should use it. I think that depends on the same reasons why people use any library. Does it fit their needs? Do they find it friendly, understandable, and in general, something they like? Does this library fit every need? No. I know there are some things missing that I look to add in the near future. As one friend of mine put it though, “it is very robust”. It is designed to fit most any need. It has simple things for the most basic JS operations (style getters/setters) to very advanced programming capabilities and a lot in between. I attempted to keep as much flexibility in the library as possible. For some of the larger, more complicated tasks (events, effects, xhr), the goal was to remove as many of the annoyances (x-browser, scoping etc) as possible while still leaving as many options open to either override the defaults and/or to allow the developer to have more control. Where possible I tried to add things with flexible parameters, flexible ways to set information (e.x. the XHR functionality allows for adding query string items 1 at a time and it will build the query for you, or you can just set the data manually), or adding additional information where traditionally there isn’t any (e.x. events can be assigned with an additional parameters that will be passed to the handler).

One last bonus, it isn’t huge. If you run it through jsmin to kill the comments, the core file isn’t too bad in size for the amount of functionality and the rest of the files can be included on an as needed basis (individually they are fairly small).

Posted by Dion Almaer at 6:40 am

3.4 rating from 30 votes


Comments feed TrackBack URI

Shortly this thing is just like Prototype but offers much less functionality, quality and popularity.

Comment by Misha — March 2, 2007

I guess you’ve tested it thoroughly and so you must be right ;)
It looks interesting to me… i’m already hooked on Mootools but Adlib is also very complete so i’ll keep it as a backup

Comment by gribelu — March 2, 2007

Subject: So I’ve Got This Great Idea

Why don’t we put ALL our objects in the global namespace?
Hell yeah man, it’s going to rule.

Comment by henrah — March 3, 2007

Leave a comment

You must be logged in to post a comment.