December 16, 2006

December 06 Meeting - Unobtrusive JavaScript

Web development happens on several layers:

  • Structure: The HTML mark-up that defines the elements on a page.
  • Presentation: The CSS that changes the appearance.
  • Behavior: Goood ole' JavaScript that can make the content interactive.

Unobtrusive JavaScript is the separation of these layers which allows web designers to create web sites that are a lot easier to use and maintain, more intuitive, and accessible. 

Here are some guidelines to make your JavaScript more 'unobtrusive'.

  • Never add JavaScript directly to the document. 
  • JavaScript is an enhancement, not a secure functionality.
  • Remove any embedded event calls. 
  • Check the availability of an object before accessing it.
  • Create JavaScript, not browser specific dialects.
  • Don't hijack other script's variables.

An interesting article (.pdf) by Matt Machell puts these ideas to use as well as the coursebook (.pdf) by Christian Heilmann that shows you proper JavaScript practices.

Have a safe and happy holiday and I'll see ya next year!