Saturday, January 06, 2007

From "What CSS and JavaScript have in Common"

Another excerpt from Chapter 2

An increasing amount of users use tools such as the NoScript Firefox extension in order to white-list sites the browser will allow to run JavaScript. This greatly increases the likelihood of users seeing what your Ajax-driven web application looks and behaves like without any scripting at all, let alone the XMLHttpRequest object.

This also applies on a less substantial, though more frequent level, as different browsers have varying degrees of support for CSS, JavaScript, and the DOM itself. As such, code will either need to branch for each different implementation of a layout or function in order to support each major browser, or it will need to degrade gracefully enough that the user should not even realize they have missed out on something unless they compare the interface in two browsers side by side.

Coding CSS and JavaScript unobtrusively not only makes it easier for the interface to degrade gracefully, it also encourages clearer lines between interface structure, design, and behavior. When keeping the markup clean of inline styles and scripts (including inline event listeners such as onclick or onsubmit), it rewards good coding practices by making maintenance easier and faster. It also means that redesigning an application can happen entirely in the stylesheets, as long as the JavaScript only references class names and element IDs. Likewise, re-architecting the client-side application does not need to impact the interface design or page structure as long as the structure, style, and scripting have sufficient decoupling to allow it.

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home