-
Notifications
You must be signed in to change notification settings - Fork 0
Plugins
atk edited this page Jun 16, 2011
·
4 revisions
tiny.js is easily extendable, because there are 3 easy entry points for plugins:
- Append any function to "t" not to spam the global scope
- Selectors can be inserted in the selector object t.cf
- Selector methods can be put inside t._
ATM, the following plugins are available:
This triple-usage Selector method can be called from any Selection through the shortcall "C":
t('ul#nav').C('open') // returns true/false depending on whether ul#nav has className "open"
t('ul#nav').C(1, 'init'); // set className "init"
t('ul#nav').C(0, 'open'); // remove className "open"
If only a string is given, it tests the first selected node for the given classname. Other than that, depending on the truthyness of the first argument, the classname given in the second argument will be either set or removed.