DHTML as a Straw-man
Christian Heilmann of the DOM Scripting Task Force published a long article called From DHTML to DOM Scripting today. In it, he claims that DHTML is awful and outdated and generally very bad, and that DOM Scripting is the second coming of Zarquon.
Okay, that was slightly exaggerated. Yet this line of thinking annoys me. DHTML is, like HTML before it, painted in a bad light, whereas XHTML and DOM Scripting are purportedly the best (and therefore only) way ahead. When you look more closely at the practices so easily associated with XHTML and DOM Scripting you see a different picture. Quoting from the weblog post:
DOM scripting assets:
- Progressive Enhancement – check if things are available, then apply those dependent on them
- Ease of maintenance – keep the maintenance as easy as possible via dynamic CSS classes and properties at the beginning of the script
- Separation of Presentation and Behaviour – add dynamic classes instead of changing the style collection
- Separation of Structure and Behaviour – use dynamic event handlers and generated elements instead of onclick and NOSCRIPT
- Using modern event handling – more than one onload please
- Avoiding clashes with other scripts – avoid global variables and encapsulate functions as methods in an object
That sounds quite reasonable. In fact, I’d say these are all very good programming practices, regardless of being used in “DHTML” or “DOM Scripting” scripts. The problem is that DHTML, and all of it, is being blamed for blatantly ignoring these practices. I consider myself to be a DHTML programmer – heck, I learned most of my stuff at the now dead DHTMLCentral – and yet I grew up to these practices. While I am aware of the type of DHTML hinted at by the DOM Scripters, virtually all of the provided scripts on DHTMLCentral fit the description, it’s not the DHTML I, and many others, know and write.
Seeing DHTML portrayed as evil pains me. It does not deserve to be used as a straw-man for good practices. I believe good practices should stand on their own merit, and the ones the DOM Scripting Task Force attempts to spread are perfectly capable of doing that.




What on earth is this guy talking about? He needs to get with the times. AJAX man! AJAX!!!
Chris | 29 March 2006, 21:43 | link
If i didnt know him better, I would say its a case of anachronism.
:) Mark, i suppose this is what everyone over at DC (or who has been in this since around then) feels. Dhtml didnt quite gets its credit as much as xmlhttp is getting. Suddenly, its all too good and everything else bad. tc
Abhi | 30 March 2006, 05:42 | link
This seems to be two people arguing exactly the same point. Javascript use on the web used to be by-and-large bad. And now it’s getting better.
When it was bad, everyone who practiced it liked to call it DHTML. Now it is becoming good, through the adoption of good programming practices by the Javascript community. As a marketing differentiator, those using these good programming practices like to refer to their style of programming as DOM Scripting. Because one of these ‘good practices’ is using DOM methods to achieve programming goals.
(Anyone who disputes the importance of marketing will be lined up and shot.)
I understand that those who ‘grew up’ with DHTML might be piqued at what superficially appears to be a sleight at their way of coding, but in reality - a good Javascript programmer is a good Javascript programmer - they will organise their code, will use DOM methods, will apply classes rather than fiddling with styles, et cetera. It doesn’t seem to me like there’s any disagreement here at all - just semantic confusion!
(and in response to commenter #2 - when on earth did xmlHTTP come into this?! Please don’t say that word when it’s not called for) :)
Skip Chris | 30 March 2006, 11:05 | link
Skip, yep, that’s the case. But I just don’t like the marketing style of blaming old words and inventing new ones.
Mark Wubben | 30 March 2006, 11:54 | link
Possibly possibly possibly.
I take your point - but it’s important to reach out and touch the unclean mass still producing lame code under the banner of ‘DHTML’, grab them by the collar, shake them, shout: “Hey you! Yes you! Stop it! Do”. They’ll understand the “Yes You!” part of that a lot easier if you call them by a name they understand and recognise :)
… even though that may be at the expense of people who’ve grown along with JS, and see no reason for semantic silliness. :(
Me - I prefer DOM Scripting as a technical term. It’s a fairly accurate description. But DHTML does have a fairly snazzy ring to it. Maybe it just needs a concerted cleansing campaign to rid it of its old-skool connotations!
Skip Chris | 30 March 2006, 13:58 | link
Chris, the first two comments were not meant to be seriously taken :)
xmlHTTP sounds so much better than ajax.
Abhi | 30 March 2006, 17:18 | link
Skip, fair enough. But even then the focus needs to be on practices, as it’s easy enough to write ugly code with “DOM Scripting”. We’ve seen that before with XHTML.
Mark Wubben | 31 March 2006, 21:15 | link
Problem is that DOM scripting wont work on various browsers all the time, where innerHTML would. I think programmers pro DOM like the logical structure of it and dislike innerHTML to be less maintainable. But in the end … all it should be about that it works in the end. W3C does not care about if it works!
Joe | 16 April 2006, 18:15 | link
Nice one Mark, I agree 100%
I also consider myself a DHTML programmer, and it irks me no end that a perfectly useable term is being disparaged and used as a scapegoat. But like you, the description Christian gives of DHTML is not the DHTML I know; and the description of DOM Scripting is the DHTML I know!
Anyway DOM Scripting is a less accurate term. You can be writing PHP, Python or Ruby, and be doing DOM scripting. But DHTML can only be done with JavaScript and the DOM - it does what it says on the tin :D
Personally, I’m rather fond of the phrase “Semantic DHTML”, but I also make the distinction “Accessible DHTML” - something which the DOM Scripting distinction doesn’t address at all, and a great deal of modern best practice scripting is not properly accessible to assistive devices, and nor does it degrade properly, because most screenreaders fall through the net of progressive enhancement [http://www.accessifyforum.com/viewtopic.php?t=4682]
Maybe we should invent our own term ;) ADHTML maybe, although that sounds a bit like ADD …
brothercake | 24 April 2006, 15:51 | link
I remember some people coining this as Unobtrusive Javascript :-)
Tim W. | 4 May 2006, 12:01 | link
I’ve always disliked these terms, they’re far too specific and misleading. Is a bit of code DHTML if it’s not doing anything but applying CSS styles? Is it still “AJAX” if i’m not using xml? What about if I use JSON and bypass xmlhttp altogether.. is it “AJAX” then?
For me, DHTML, “AJAX”, DOM scripting, etc.. they’re all “Client side”.
Dan | 21 May 2006, 03:38 | link