Make your Javascript future-proof

Dean Edwards has come out with what he calls Yet Another JavaScript Library Without Documentation. This library doesn’t do anything interesting like script.aculo.us or jQuery. It only does standards. But if you build on standards in the right way, you can help future-proof your scripted pages.

Because this library is standards-based it means that you don’t have to learn a new API. It uses standard DOM properties and methods throughout which also means that Dean don’t have to write any documentation. It is part of a suite of little libraries that Dean’s developing called base2. This is the first library under that umbrella and is called base2.DOM.

Highlights

  • A fast implementation of the Selectors API
  • Fixes broken browser implementations of the DOM events module including document.createEvent(), dispatchEvent(), addEventListener(), etc
  • Supports DOMContentLoaded
  • Fixes getAttribute()/setAttribute() (Internet Explorer)
  • Implements getElementsByClassName()
  • Implements a few other useful DOM methods like getComputedStyle() and compareDocumentPosition()
  • Supports a variety of browsers including ancient browsers like IE5.0 (Windows and Mac)

Only a few caveats

  • This implementation of the Selectors API does not support namespaces
  • This implementation of the Selectors API supports all the selectors that cssQuery supports except :lang() and :target
  • getAttribute() will return null if the attribute is unspecified. This is contrary to the specification but seems to be the de facto standard

Link to Yet Another JavaScript Library Without Documentation

If you about to author a javascript library, remember - Dean Edwards Rules!