Jeremy Keith is a web developer living and working in Brighton, England. He works hard (with Clearleft) and he plays hard (with Salter Cane). Jeremy is a member of the Web Standards Project where he serves as joint leader of the DOM Scripting Task Force.
His online home is adactio.com where he writes about web standards, accessibility and whatever the hell else he feels like writing about (although not usually in the third person).
Jeremy: I could give you the very unhelpful answer that it's an API, but I would just be exchanging one acronym for another.
Basically, the Document Object Model is a way of looking at a document. In that sense, it isn't all that different to CSS, which uses another kind of mental model. CSS uses the idea of selectors to interact with a document. The DOM, on the other hand, views a document as a tree of nodes: element nodes, attribute nodes and text nodes. The DOM provides a vocabulary for targeting and manipulating those nodes.
If a programming language supports the DOM then you can use that same vocabulary to address any kind of markup document.
Jeremy: Oh, that's your attitude, is it? "Look at that language with its easy syntax and powerful capabilities: it's clearly asking for it."
It reminds me of Flash in some ways. There's nothing inherently bad about Flash at all. But after years of being abused to create bloated intro pages, the technology itself garnered a reputation for being nasty.
The most prevelant example of this is the ubiquitous use of
Thankfully, with a little forethought, the behaviour layer can be added in such a way that it degrades gracefully.
But anyway, the point is: you wouldn't ask, "Can CSS be used for good instead of evil?" You would expect that the default usage of CSS would be to make sites look good, not bad. That's partly because most developers don't use CSS to make ten foot tall green text on a red background but it's mostly because there are sites like the CSS Zen Garden as well as high-profile commercial sites using CSS for good, not evil.
But really, there's only so much that one group of people can do. In order to create a landscape of useful DOM Scripting resources, the developers themselves will need to share what they learn on blogs and mailing lists. That's what happened with CSS: there wasn't one central authority coming up with all the best practices and techniques. Instead, it was an ad-hoc peer-to-peer network of enthusiastic web developers eager to share their knowledge. I'd really like to see the same thing happen for DOM Scripting. I'm hoping that the task force will help create the right kind of atmosphere for that kind of activity.
Jeremy: Yes, it's true. I've written a book. It was modesty, not shame, that prevented me from mentioning it sooner.
Jeremy: There are three cornerstones in the book:
Those ideas permeate all the examples shown in the book. The examples themselves are quite straightforward although they do increase in complexity as the book progresses. At the end, there's a finished website showcasing a lot of the techniques.
It's aimed very much at designers rather than programmers. Specifically, it's aimed at designers who are already appreciating the value of web standards like CSS and semantic markup. The book isn't really intended for advanced programmers. It would probably bore them to tears.
Jeremy: Oh, my <airquotes>friends</airquotes> told you that, did you? I'll have to have a talk with those "friends".
You know what my problem is? I can't help rooting for the underdog. Five years ago, everyone was using
tables to layout their websites. I started using CSS partly because I saw a worthy cause that needed to be championed. It's a similar situation now with DOM Scripting. I can see the enormous benefits that this technology can offer if it's just used correctly and I want to spread the word.
Liquid layouts are the underdog of the design world. Designers will come up with all sorts of spurious excuses as to why they won't use them but in most cases, they are simply scared. Firstly, liquid layouts are difficult. That makes them scary enough. Mostly though, designers are scared of giving up control. This fear is the last bastion of the Web 1.0 mentality of control and it's one I hope will loosen its grip soon.
Yes, I've built real sites using liquid layouts. For most information-based sites, it's the clear choice. Really, designers should have to come up with reasons not to use flexible layouts when they'e designing for a flexible medium like the World Wide Web.
So, you want me to name names, huh? There's my personal site, Adactio. There are a whole bunch of different themes on offer. All but one of them are liquid. My portfolio is up there too so you can peruse that for more examples of liquid layouts. Just recently, for the Clearleft website, I created a liquid environment for Andy's design and Richard's words.
To be honest, I've never had that many problems with IE's decision to rearrange floated columns from side-by-side to one on top of the other. The problem is usually caused by large fixed-width content, like images. Either I've used background images or set the width of the images in percentages (as is the case with the Clearleft site).
Maybe I'm being unduly optimistic but I have a feeling that liquid layouts might be having something of a resurgence. Dan Cederholm devoted a whole chapter of his new book to the topic, someone has a started a liquid layout showcase site and then there was your excellent presentation at Web Essentials. Personally, I think every web designer on the planet should read John Allsop's A Dao Of Web Design — it's five years old but it's never been more relevant.
Well, I bet you're regretting that you ever raised the subject now. Maybe I am slightly obsessed. I'll shut up now. Thanks for giving me the chance to vent.
What I really want to do is take the DOM Scripting show on the road. After speaking at Skillswap, @media and South by SouthWest, I really got a taste for speaking to a captive audience. I plan to do more of that. I've been giving day-long DOM Scripting training courses, which I've enjoyed immensely. I'll also be speaking again at SxSW again next year.
But my real ambition is to speak at a certain conference held in Sydney (hint, hint).
Copyright © Web Standards Group 2012