A good start to the learning phase:
- Dom Scripting (Book)
- Understanding the DOM
- Understanding Scope
- Event deligation
Another useful thing to learn seems to be Closures, which can lead to memory leaks.
Useful looking scripts
- Enumeration (automating the creation of object loops, I think)
- StringBuilder (via).
- Usable auto-focus
- Dynamically change the visible elments.
- Shows which key is which code.
Quite a few tips ‘n tricks:
- Yahoo’s take, including minimisation techniques.
- Event handling verses delagation
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?
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.
- Dojo, complex (self-building even?), and recently got backing from IBM & Sun.
Thank you for the links. I am going to use the StringBuilder