Document Object Model Plugin for the Sandbox API
Eric Bréchemier © 2011, Some Rights Reserved Legal-Box SAS © 2010-2011, All Rights Reserved
BSD License http://creativecommons.org/licenses/BSD/
2011-08-14
lb. | Document Object Model Plugin for the Sandbox API |
Functions | |
dom(sandbox) | Define methods in the ‘dom’ property of given sandbox. |
sandbox. | Get the element of the box with given local identifier. |
sandbox. | Create a new DOM element using the configured DOM factory. |
sandbox. | Create and dispatch a new DOM event to the given element, using the configured DOM factory. |
sandbox. | Cancel an event using the configured DOM factory. |
sandbox. | Get the list of listeners configured on DOM elements of the box. |
sandbox. | Register a new listener for a type of event on a DOM element of the box using the configured DOM factory. |
sandbox. | Unregister a listener, using the configured DOM factory. |
sandbox. | Remove all listeners configured on DOM elements of the box, using the configured DOM factory. |
Get the element of the box with given local identifier.
localId | string, the local identifier of the element, without prefix. See getId() for details. |
A call to $() with no argument will return the box element, similarly to getBox(false).
Create a new DOM element using the configured DOM factory. For example, using the default DOM factory,
element('a',{href:'#here',title:'Here'},'Click here')
will create a new DOM element
<a href='#here' title='Here'>Click here</a>
A custom DOM factory can be configured using the property lbFactory with lb.core.application.setOptions(options).
name | string, the name of the element |
attributes | object, optional arguments as a set of named properties |
childNodes | array or list of arguments, the optional child nodes. Text nodes shall be represented simply as strings. |
DOM Element, the newly created DOM element.
Create and dispatch a new DOM event to the given element, using the configured DOM factory.
element | DOM Element, an element of the box |
type | string, the name of an event (without ‘on’) e.g. ‘click’ |
properties | object, optional event properties. Each property will be copied to the new DOM event. |
DOM Event, the new DOM event
Get the list of listeners configured on DOM elements of the box. Listeners can be added with addListener() and removed one by one with removeListener(), or all at once with removeAllListeners().
array, the current list of listener objects (lb.base.dom.Listener)
Register a new listener for a type of event on a DOM element of the box using the configured DOM factory.
element | DOM Element, an element of the box |
type | string, the name of an event (without ‘on’) e.g. ‘click’ |
callback | function, a function to call when the event is dispatched. |
Remove all listeners configured on DOM elements of the box, using the configured DOM factory.
All remaining listeners, previously configured with addListener(), add removed. This method is intended as a cleanup utility ; it is called automatically by the framework after the module terminates in end(), which makes its use optional for the module itself.