A few things that I would add.
$$('.myClass').each(function(d) { d.hide(); });
can be replaced by the following:
$$('.myClass').invoke("hide");
Also, be careful with using $$ , on a page with a large dom it is usually faster to orient the parent with $ , and then use select() for your selector
So
$$('div#outer div#inner') etc....
can be rewritten as follows:
$('parent_of_inner_and_outer').select('div#outer div#inner') etc....
source share