Simon Willison’s Weblog

Dithered DOM scripts

Dithered.com’s DOM Scripts follow an interesting philosophy:

One thing that always bothered me about DHTML APIs in particular is that you introduce a whole set of non-standard properties and methods in order to deal with the fact that not all browsers implement the standard properties and methods. You should attempt to preserve a standard as best you can. For instance, in order to get a reference to an element, the standard defines document.getElementById(). For systems that don’t support this method, you could create a method of the document object with the name getElementById that mimics the standard behaviour. That way, you aren’t married to a non-standard API and won’t be screwed when the developer stops supporting it or a new browser introduces something that breaks the API.

This is Dithered DOM scripts by Simon Willison, posted on 19th March 2003.

Next: Useful python resources

Previous: Javascript prototypes

Previously hosted at http://simon.incutio.com/archive/2003/03/19/ditheredDomScripts