lb.core.plugins.css

Cascading Style Sheets Plugin for the Sandbox API

Authors

Copyright

Eric Bréchemier © 2011, Some Rights Reserved Legal-Box SAS © 2010-2011, All Rights Reserved

License

BSD License http://creativecommons.org/licenses/BSD/

Version

2011-08-14

Summary
lb.core.plugins.cssCascading Style Sheets Plugin for the Sandbox API
Functions
css(sandbox)Define methods in the ‘css’ property of given sandbox.
sandbox.css.getClasses(element): objectGet the CSS classes of given DOM element.
sandbox.css.addClass(element,name)Append a CSS class to a DOM element part of the box.
sandbox.css.removeClass(element,name)Remove a CSS class from a DOM element part of the box.

Functions

css(sandbox)

Define methods in the ‘css’ property of given sandbox.

Parameters

sandboxobject, the sandbox instance to enrich with CSS methods

sandbox.css.getClasses(element): object

Get the CSS classes of given DOM element.

Parameter

elementDOM Element, an element of the box

Returns

object, a hash of CSS classes, with a boolean property set to true for each of the CSS class names found on element, e.g.

{'big':true, 'box':true}

for

<div class='big box'></div>.

When no class attribute is present, or when it is empty, an empty object is returned.

Note

When the element is out of the box, an empty object is returned as well.

sandbox.css.addClass(element,name)

Append a CSS class to a DOM element part of the box.

Parameters

elementDOM Element, an element of the box
namestring, a CSS class name

Note

Nothing happens if element is out of the box.

sandbox.css.removeClass(element,name)

Remove a CSS class from a DOM element part of the box.

Parameters

elementDOM Element, an element of the box
namestring, a CSS class name

Note

Nothing happens if element is out of the box.

Close