November 2002

11/28/2002 Thursday

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. A couple years ago, I tried building a DHTML API targetted at version 4 browsers that used methods of the DOM. That way, I knew it would continue to work on DOM-compliant browsers and, when the v4 browsers disappeared, I would just have to remove the line that included the library in a page and it would still work fine. I didn't finish it. I barely got started when I realized that there was no way I would be able to get it to work with NS4. Today, I made a different library with a similar concept. This one on allows you to work with events in IE5+ with the DOM2 event properties and methods. No more (well, much less) dealing with branching code in event handlers. You can attach event listeners with addEventListener(), remove them with removeEventListener(), query properties like target and currentTarget, and use methods like preventDefault() and stopPropagation(). Enjoy.
04:15 permalink

11/12/2002 Monday

Content-to-code ratio and page weight measurement results.
13:00 permalink

11/01/2002 Friday

gamebutton arcade - arcade games played inside form buttons. I love the challenge of trying to be creative within a set of rigid (and somewhat arbitrary) constraints. Like the 5k. (via Boing Boing)
09:40 permalink