AdvancED DOM Scripting

2 comments | Posted: 13 January 08 in Books, by Nathan Smith

AdvancED DOM Scripting If you are an avid Flash developer, Friends of ED is perhaps the single most important book publishing company. They are well known for their AdvancED series, explaining the nuances of ActionScript and so forth. It is only fitting then, now that JavaScript has become so important to modern web design, that AdvancED DOM Scripting would be crafted in similar fashion. This task was tackled by Jeffrey Sambells, with a little help from Aaron Gustafson.

My favorite thing about this book is that it seeks to do right by the client-side, though still written by someone with server-side programming certification. Meaning, best practices are followed throughout, with graceful degradation, progressive enhancement, and accessibility in mind.

Sambells refreshingly describes the evolution of JavaScript. Rather than dwell on the browser wars, or the history of the language, he shows how to approach a task using a variety of different methods. After which, he then blows it all out of the water, and explains how to code most efficiently.

Now that you understand the different ways of writing inline event listeners… forget that I ever told you about inline event attributes. Showing you the evolution of the different methods [was] necessary so that you can see the benefits of the next solution.

He then goes on to explain how to unobtrusively add dynamic behavior by parsing the DOM tree when the page loads. This is far superior to using onclick attributes, thereby keeping your HTML free of unnecessary cruft. One might wonder: “Why bother showing antiquated techniques at all?” I think it is important to show how far we’ve come. George Santayana said it best:

Those who cannot learn from history are doomed to repeat it.

Throughout the book, he consistently demonstrates best practices for a variety of tasks and scripting situations. Each lesson learned becomes an addition to a custom JS library, which he calls ADS. There are a few very cool demo projects, such as a dynamic image editor, ala Flickr photo cropping. He also shows how to upload files with Ajax while displaying a real-time progress indicator.

If all he covered was creating your own custom codebase, this book would have been well worth it. However, he does not stop there, opting to explain popular JavaScript libraries via practical examples. Some of these libraries are: YUI, Prototype, script.aculo.us, Mootools and my personal favorite jQuery.

Beyond that, there is a case study chapter by Gustafson on how to make <select> drop down menus look consistent across varying browsers and operating systems. Essentially, the markup is parsed and then transformed into something that can be styled more reliably. There is also a great chapter on incorporating Google Maps, even going so far as to be accessible.

Despite a few typos here and there, I would have to say this is one of the best JS books I have ever read. If you are tired of just repurposing scripts made by others, and want to really delve into mastering the techniques, this book is for you. After reading it, I guarantee that you will have a solidly understand the intricacies of JavaScript and the Document Object Model.

Discuss This Topic

  1. 1 Ben

    Nathan, is this a book that one would already need to be able to program in JavaScript? Or could someone w/ limited programming experience make use of it?

     
  2. 2 Nathan Smith

    Ben: The “ED” in Friends of ED stands for “Every Designer.” Apress is their parent company, and titles published by under that banner tend to be geared more towards left-brained people. Likewise, books from Friends of ED are meant for a design minded audience. Someone like yourself, who has experience with Mootools, would benefit a lot from this book.

     

Comments closed after 2 weeks.