DOM Scripting: the Art of Unobtrusive Javascript

Posted September 14, 2006

Since its debut in 1995, Javascript has had a bad rap with web developers.  It’s not that the versatile scripting language wasn’t useful; on the contrary, Javascript let developers manipulate web documents on-the-fly, adding life to what had been static html pages.  For example, the ubiquitous image rollover, a key Javascript capability, made its first appearance then.  With that effect and others powered by Javascript, the web would never be the same.

But there were problems with the language, big ones.  Early versions of Javascript from Netscape and Microsoft weren’t strictly compatible and the language’s relative simplicity had every designer dropping Javascript into her pages.  The result was a certain chaos as powerful Javascript-enabled effects were implemented without attention to their reliable function in all browsers.  There was also the matter of website usability, or “disusabilty” for some Javascript-laden sites.  Consider the Javascript-enabled pop-up window--a valuable tool but one that has been devalued over the years in the torrent of uninvited pop-up ads.

Much has changed, though, in the last eleven years.  Modern browsers are now reasonably consistent in how they handle Javascript and a new revolution has flickered into existence at the web’s fringes.  It goes by the name of Web Standards. 

The Web Standards gang is pushing the adoption of eXtensible Hyper Text Markup Language (XHTML) and Cascading Style Sheets (CSS), two robust technologies that separate the semantic structure of a web page’s data from its ultimate presentation.  The two promise to dramatically reduce the size of web pages and to ensure a consistent web experience for web surfers using any browser.  You can read more about the movement here: www.webstandards.org.

There’s a third leg to the Web Standards revolution that has received less attention.  It goes by the name of DOM Scripting and it promises to finally restore Javascript’s good name.  DOM Scripting focuses on using unobtrusive Javascript that doesn’t mess with the finally honed markup of XHTML and that doesn’t aggravate website usability the way early use of Javascript did.  A great introduction to the DOM Scripting comes from Jeremy Keith, a web developer from Brighton, England.  His book, DOM Scripting: Web Design with JavaScript and the Document Object Model, is an excellent introduction to the subject and highly recommended by MediaFatigue. 

If DOM Scripting takes off (and we hope it does), Javascript may yet be invited to the party as an honored guest. 

categories: Javascript 
permalink