Bonsai (2.0)
Copyright 2006 (C) Jason Davis, www.jasonkarldavis.com
This code is licensed under the LGPL:
http://www.gnu.org/licenses/lgpl.html
List of files:
bonsai.js
bonsai.htc
bonsai-persistence.js
bonsai-alternate.js
Documentation:
Simply call `Bonsai(list)` to turn list into a collapsable tree, where list is
a reference to an HTMLUlElement. Subtrees are inserted via
elements inside
- elements.
When a tree is opened or collapsed, an event is fired on the root
elements.
Setting up listeners for "expand" and "collapse" (via addEventListener) or for
"onexpand" and "oncollapse" (via attachEvent) will capture these events before
they happen, and subsequently can prevent the event via preventDefault() or by
setting the returnValue property to false.
Modules are separate bits of functionality which enhance the entire menu. For
example, bonsai-persistence.js defines a persistence module using cookies. It
works by utilizing the `Bonsai.addModule(func)` command. func accepts a single
argument, representing the HTMLUlElement, and otherwise operates entirely
independent of the Bonsai script itself. The only connection it has to Bonsai
is that it is called before the creation of the tree itself is considered done.