Class Index | File Index

Classes


Class pv.Dom

Represets a DOM operator for the specified map. This allows easy transformation of a hierarchical JavaScript object (such as a JSON map) to a W3C Document Object Model hierarchy. For more information on which attributes and methods from the specification are supported, see pv.Dom.Node.

Leaves in the map are determined using an associated leaf function; see #leaf. By default, leaves are any value whose type is not "object", such as numbers or strings.
Defined in: Dom.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
pv.Dom(map)
Constructs a DOM operator for the specified map.
Method Summary
Method Attributes Method Name and Description
 
leaf(f)
Sets or gets the leaf function for this DOM operator.
 
Applies the DOM operator, returning the array of all nodes in preorder traversal.
 
root(nodeName)
Applies the DOM operator, returning the root node.
Class Detail
pv.Dom(map)
Constructs a DOM operator for the specified map. This constructor should not be invoked directly; use pv.dom instead.
Parameters:
map
a map from which to construct a DOM.
Method Detail
leaf(f)
Sets or gets the leaf function for this DOM operator. The leaf function identifies which values in the map are leaves, and which are internal nodes. By default, objects are considered internal nodes, and primitives (such as numbers and strings) are considered leaves.
Parameters:
{function} f
the new leaf function.
Returns:
the current leaf function, or this.

{array} nodes()
Applies the DOM operator, returning the array of all nodes in preorder traversal.
Returns:
{array} the array of nodes in preorder traversal.

{pv.Dom.Node} root(nodeName)
Applies the DOM operator, returning the root node.
Parameters:
{string} nodeName Optional
optional node name for the root.
Returns:
{pv.Dom.Node} the root node.

Documentation generated by JsDoc Toolkit 2.3.2 on Fri May 28 2010 10:13:28 GMT-0700 (PDT)