Skip navigation.

Purple ThingsAll recent postsDisplaying Localized Text From Embedded JavaScript

Book Review: DOM Scripting

This book, according to Jeremy, “isn’t intended for programmers. This is a book for web designers. Specifically, this book is intended for standards-aware designers who are comfortable using CSS and XHTML.” If you’re new to JavaScript, there’s a rather brief intro to the language, while the rest of the book deals with manipulating the Document Object Model with JavaScript.

The two most important concepts you need to take away are:

Progressive Enhancement…

“The principle of progressive enhancement is based on the idea that you should begin with your core content. The content is structured using markup. The marked-up content is then enhanced. The enhancement might be stylistic, using CSS, or it might be behavioral, using DOM Scripting.”

… and Graceful Degradation

“The corollary to progressive enhancement is graceful degradation. If you have progressively enhanced your content, then it follows that your stylistic and behavioral enhancements will degrade gracefully. Visitors to your web site who lack the means to benefit from your CSS and DOM Scripting will still be able to get to your core content.”

What About Accessibility?

DOM ScriptingJeremy raises an interesting point: the old days of browser wars bred too much poorly developed client-side code which lead people to believe that JavaScript was an enemy to accessibility. This is not necessarily the case.

When talking about accessibility, people love to site blind users who use old-era green-and-black monitors with lynx as their web browser. I think it’s a grossly distorted stereotype. Read this very interesting comment from an accessibility consultant at Veerle’s blog. I think I learned more about accessibility from this comment alone than from numerous posts and books I’ve read.

When DOM Scripting Backfires

Another interesting point: If you’re injecting important content with JavaScript, you’re doing it too late. Clients (meaning devices, search bots, etc) which do not support JavaScipt, can’t get to your content.

In this context, DOM Scripting is a tool. When you hold a hammer, everything looks like a nail. So… Use your head and don’t abuse the tool.

Getting Practical

As the mentioned accessibility consultant pointed out,

“In real world situations, designing with web standards has very little advantages for people with physical disabilities. And in some situations, it might even impede accessibility […]. In a more general context (device and user agent independency, future compatibility, bandwidth savings, easier updating, better indexing by search engines and such), designing with web standards is of much more importance.”

I keep hearing this sentiment about users who disable JavaScript or use browsers that don’t support them, but I don’t know if it holds water in real life. Of course, you can join an Amish community and live without electricity, but few (if any) of us do. I’d be worried much more about Ajax which causes content to appear and disappear sporadically.

Conclusion

The book is nicely organized, and the material is very easy to follow. If you want a more technical book in this same subject, check out The Document Object Model book by Joe Marini. And, of course, I’d commit a sin of omission if I don’t mention the best book JavaScript: The Definitive Guide by David Flannagan. Still, DOM Scripting is an interesting read for “standardistas.”

What I really want to see now is a book about pragmatic applications of JavaScript, namely:

In other words, I’d love to see a book on how people use JavaScript for real. In real web products. Not W3C specs.

Comments

Comment permalink 1 pauldwaite |
> "people love to site blind users"

"Cite" blind users, I think.

> "I’d be worried much more about Ajax which causes content to appear and disappear sporadically."

I'd say that many current uses of the technique do this, but it's not inherent in asynchronous calls. One of the first famous usages was Google Suggest, suggesting search terms as you type. I'd argue that doesn't cause extra content to appear, it provides a usability benefit that couldn't be achieved without JavaScript.

Aren't most of your wish list of JavaScript book topics covered in the 5th edition of The Definitive Guide?
Comment permalink 2 Carl Camera |
Thanks for the review. This book has been on my radar screen and will probably be promoted to wishlist soon. I'm rather partial to the O'Reilly titles so the Definitive Guide might make the list also.

Emails and Notifications

Would you like to be notified when somebody responds to this post?  Would you like to have these comments emailed to you?

Submit your comment

Please enter only text since all HTML tags except hyperlinks will be stripped. Hyperlinks will become live links. Any comments with flaming or offensive language will be deleted. Be courteous to other posters. Thank you.

Your name (required):
Your email (optional):
Your site's URL (optional):
Enter this number
Type in the number above:
Comment (required):