mootools madness

mootools is a spectacular little JavaScript framework, but the “tricks of the trade” you need to know to get anything done with it on a timely basis can be a bit maddening. Here are three examples:

  1. The API seems to change randomly, drastically, and constantly. In v1.00 we could getElementsByClassName(), but seemingly no more in v1.11. Looking ahead at subversion, lots of API changes seem to be coming down the pipe.
  2. When using the Accordion, don’t make the mistake of downloading the automatically selected dependencies from the mootools download builder and expect it to work. The Accordion demo illustrates how to use accordions with “domready”, for which you will also need Window.DomReady as well as Element.Selectors and it’s dependencies. (To complicate matters, Element.Selectors seems to have become a stand-alone Selectors class.)
  3. When testing in IE, make sure you have a doctype declared. eg:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    If not, the accordion will not collapse properly, leaving lower panels filled with vast tracts of dead space, and you with a rising stress level, and even less hair, and all because you can’t, for the freaking life of you, figure out what is different between your freaking code, and the virtually identical freaking stuff on the freaking mootools site and in the end it turns out it’s just a freaking missing freaking doctype.

    (I guess IE won’t fork over DOM support unless once declares the doctype.)

So, overall, great little JavaScript framework. But.. Freaky.

Leave a Reply

Your email address will not be published. Required fields are marked *