Freelance Web Developer


A JavaScript Framework

A JavaScript Framework

When I decided to learn JavaScript I found, quite quickly, that while it is a powerful language, which came as a surprise since I always thought of it as a simple automation lauguage for browsers, there are numerous holes.

These holes were filled by numerous framework libraries for doing all sorts of things. Be it filling in some small missing functions like addAfter to compliment addBefore, or extra trim functions for strings as you would find in PHP, there were, and still are, numerous choices.

Over the years I have flirted with Prototype, script.aculo.us, ExtJS, Dojo and numerous small snippets found all over the web but I never stuck with them.

Perhaps it was, at the time, my desire to write things from scratch to learn the language, or perhaps it’s my still present need for control over what I’m doing, but I’ve more often than not fallen back to writing and using my own libraries.

Initially, as is always the case, I noticed I was always using the same functions, or doing the same things over and over again so I added them to a little file that I included in all the small projects I was using the teach myself. As I added more and more functions to this small file I realised I had the makings of a little library so I cleaned it up over the years.

Taking in no small part from the ideas, though not the code, in prototype and augmented by ideas and snippets I’ve found as I’ve gone along I have put together a small, well smaller than prototype, library that I now use for all my projects.

The DarkSnow Utility library, dsUtils, contains all those little things that JavaScript should probably have in it. It uses the Function, String and Element prototype to extend those definitions and it’s getElementById function ($()) will extend any element it gets so that other browsers can use the extensions too.

So, what does it do?

Below I’ve put together a list of all the functions in this little library. I’ve also attached the file to this post so you can download and use the library if you think it’ll be handy. This is a brief overview of what it does and I may write more about any particular section when I’m thinking about it, or cleaning up sections.

I hope someone will find this useful, I know I do.