You are previewing Test-Driven JavaScript Development.

Test-Driven JavaScript Development

Cover of Test-Driven JavaScript Development by Christian Johansen Published by Addison-Wesley Professional

Chapter 9. Unobtrusive JavaScript

In Chapter 2, The Test-Driven Development Process, we saw how test-driven development can help create “clean code that works.” Unfortunately, even perceptibly clean code can cause problems, and on the web there are many degrees of “working.” Unobtrusive JavaScript is a term coined to describe JavaScript applied to websites in a manner that increases user value, stays out of the user’s way, and enhances pages progressively in response to detected support. Unobtrusive JavaScript guides us in our quest for truly clean code; code that either works, or knowingly doesn’t; code that behaves in any environment for any user.

To illustrate the principles of unobtrusive JavaScript, we will review a particularly obtrusive ...

The best content for your career. Discover unlimited learning on demand for around $1/day.