AdvancED DOM Scripting
2 comments | Posted: 13 January 08 in Books, by Nathan Smith
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.
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.
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.
Discuss This Topic
Comments closed after 2 weeks.