JavaScript - - By Simon Willison

2005: The year of the DOM

Jeffrey Zeldman popularised the concept of the “three legged stool” approach to web design in his book, Designing with Web Standards. The three legged stool consists of XHTML for content and structure, CSS for presentation and JavaScript and the DOM for “behaviour”. CSS and XHTML have had an excellent couple of years in 2003 and 2004, but what of JavaScript and the DOM?

I think that 2005 will be the year that proper use of the DOM really takes off. Most JavaScript on the web still hails from the late ’90s, but change is in the air. Netscape 4 is practically dead and gone, and the current crop of browsers all offer excellent DOM support (even Opera has caught up). There are very few reasons not to take the DOM seriously, and a great deal of effort is being invested in exploring new, effective ways of taking advantage of client-side scripting technology.

The challenge, of course, is accessibility: while JavaScript technologies allow for much improved interactivity they remain unavailable to a significant portion of user agents. The solution is to treat JavaScript as a tool for enhancing the user experience for those who can benefit from it, while avoiding cutting off access to others. A classic example is Google Suggest – it’s great if you have JavaScript turned on, but you can still use Google’s primary search function without it.

Google Suggest also demonstrates what I think will be a key theme for 2005: XMLHttpRequest. Loading additional data interactively from the server has been a dream of client-side developers for years, and XMLHttpRequest finally provides an “official” method for doing exactly that (previous remote scripting efforts had revolved around ingenious hacks). GMail and Google Suggest have sparked a huge interest in this technique and it’s certain that we’ll see a lot more of it over the next 12 months. The ObjectGraph Dictionary is another example.

Joel Spolsky concludes How Microsoft Lost the API War with the observation that “The new API is HTML, and the new winners in the application development marketplace will be the people who can make HTML sing.”. If that holds true in 2005, JavaScript and the DOM will have a very good year.