JavaScript

A good start to the learning phase:

Another useful thing to learn seems to be Closures, which can lead to memory leaks.

Useful looking scripts

Optimisation

Quite a few tips ‘n tricks:

Fixing onLoad

Any script using onLoad that kicks in once the page has loaded will have to wait for images & assets to load first. What you really want is the DOMContentLoaded event, but only Moz & Opera support this.

There are a couple of solutions for this, the first (chronologically at least) is Brothercake’s DOMReady script. Another option (using the interesting looking conditional code for IE) is Dean Edward’s window.onload solution. A variation on that that allows multiple function calls is Jesse Skinner’s addDOMLoadEvent, which I’ll be trying shortly. Or perhaps the YUI libary will cover it?

Accessible JavaScript

JavaScript Libraries

Many are too much, a few have caught my eye, in order of apparent size & complexity:

  • DOMAssistant, several good/best practice functions to make JS easier.
  • Base2, from Dean Edwards, notable for being a ‘standards based’ library, using current and upcoming standards as it’s basis for creating a cross-browser library.
  • jQuery, which uses a small library to allow you to write JavaScript easily, using CSS & Xquery style selectors.
  • Yahoo’s user interface library, this one gets my vote: Yahoo respect JavaScript as a language, it has plenty of support & documentation, and they’ve mentioned something about accessibility.
  • Dojo, complex (self-building even?), and recently got backing from IBM & Sun.

One contribution to “JavaScript

Leave a Reply

Your email address will not be published. Required fields are marked *