5 BEST PRACTICES

What this chapter covers:

  • Graceful degradation: ensuring that your web pages still work without JavaScript.
  • Unobtrusive JavaScript: separating structure from behavior.
  • Backwards compatibility: ensuring that older browsers don't choke on your scripts.

Together, JavaScript and the Document Object Model form a powerful combination. It's important that you use this power wisely. In this chapter, I'm going to show you some best practices that you can use to ensure that your scripts don't do more harm than good.

Please don't let me be misunderstood

JavaScript has something of a bad reputation. Right from its inception, seasoned programmers treated it with skepticism. The convoluted origin of the name JavaScript certainly did not ...

Get DOM Scripting: Web Design with JavaScript and the Document Object Model now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.