classNames :: Element |
Practically, this means that you have access to your element's CSS classNames as an Enumerable rather than as the string that the native className property gives you (notice the singular form).
On top of that, this array is extended with a series of methods specifically targeted at dealing with CSS classNames: set(className), add(className) and remove(className). These are used internally by Element.addClassName, Element.toggleClassName and Element.removeClassName, but—unless you want to do some pretty wacky stuff—you usually won't need them.
Examples
<div id="mutsu" class="apple fruit food"></div>
$('mutsu').classNames() // -> ['apple', 'fruit', 'food']
// change its class names: $('mutsu').className = 'fruit round'
$('mutsu').classNames() // -> ['fruit', 'round'] |
Prototype API 1.5.0 - prototypejs.org