Project Outline
«
pulp javascript framework

Namespace pulp.node

Defined in: pulp.node.js.

Field Summary
^ top
update Set the innerHTML
support perform capability testing to be used in other functions
Method Summary
^ top
select(selector) Return an array of descendent nodes that match the given selector If pulp.nodeList is available, return the results in a pulp.nodeList object
match(selector) Return true if the node matches the given CSS selector
_setCache() Save a reference to this object on the node itself see below for circular reference decupling for IE6
setStyle(attr, value) (chainable) Set the css style of a node.
getStyle(attr) Set the css style of a node.
setOpacity(A) (chainable) Set the opacity style
getOpacity() (chainable) Get the opacity style
get(property) Get the raw value of any given property (e.g.
set(property, value) (chainable) Set the raw value of any given property (e.g.
html(html) (chainable) Get or set the innerHTML (sets when argument is present, gets when argument is absent)
hasClass(className) Return true if the node has the given css class name (aliased as hasClassName)
addClass(className) (chainable) Add a css class name to the node (aliased as addClassName)
removeClass(className) (chainable) Remove a css class name from the node (aliased as removeClassName)
toggleClass(className, onOff) Remove a css class if present or add if not pressent
hide() (chainable) set display style to none to visually hide the node
show() (chainable) Set display style to an empty string
remove() (chainable) Remove the node from the document tree
replace(node) (chainable) Replace a DOM node
prependChild(child) (chainable) Add a new child to this node as the first child
appendChild(child) (chainable) Add a new child to this node as the last child
replaceChild(newEl, oldEl) Replace child with another element
insertBefore(child) (chainable) Add a node immediately before this one
insertAfter(child) (chainable) Add a node immediately after this one
wrap(wrapper [, deepest=true]) Wrap a node in HTML or another node
wrapInner(wrapper [, deepest=true]) Move all child nodes into a new wrapper
getDeepestChild() Return the first node at the deepest level
getChildren() Get an array of child nodes as pulp.node objects
getPrevSibling() Get the sibling that comes immediately before this one
getNextSibling() Get the sibling that comes immediately after this one
getSiblings() Get an array of all siblings as pulp.node objects (don't include this node)
getNextSiblings() Get an array of siblings as pulp.node objects that come after this node
getPreviousSiblings() Get an array of siblings as pulp.node objects that come before this node
getAncestors() Get an array of ancestors of this node as pulp.node objects
up([selector=""]) Get the first ancestor matching the given tag name, index, or css selector
down([idx=""]) Get the first descendant matching the given tag name, index, or css selector
isDescendantOf(parent) Return true if the node is a descendent of the given node
identify() Get the id attribute of a node.
getDimensions() Get the height and width of the node in px
getHeight() Get the height of the node in px
getWidth() Get the width of the node in px
cloneNode(withChildren) Return a copy of the pulp.node being sure to remove the clone's id attribute.
setAttribute(attr, The) Set an attribute on a node
getAttribute(attr) Return the value of the specified attribute (special treatment for IE)
hasAttribute(attr)
removeAttribute(attribute) (chainable) Remove the given attribute
offsetParent() Return the first ancestor with offset of static (or body if none ar found)
getInstance(The) Return a new pulp.node by node id or node handle
htmlToNodeList(html, doc) Convert an html string to an HTMLNodelist object
_camelize(Thes) Convert a hyphen-delimited string to a camelCase string
styleStringToObject(CSS) Convert a CSS style string to an object
Field Detail
^ top
update : pulp.node
Set the innerHTML

									
								
									
										
										
										
										
				
								
pulp.node.support
perform capability testing to be used in other functions

									
								
									
										
										
										
										
				
								
Method Detail
^ top
select(selector) -> Array|pulp.nodeList
Return an array of descendent nodes that match the given selector If pulp.nodeList is available, return the results in a pulp.nodeList object

Defined in: pulp.cssQuery.js.


										
									
Parameters:
{String} selector The CSS query to use
Returns:
{Array|pulp.nodeList}
match(selector) -> Boolean
Return true if the node matches the given CSS selector

Defined in: pulp.cssQuery.js.


										
									
Parameters:
{String} selector The CSS query to use
Returns:
{Boolean}
_setCache()
Save a reference to this object on the node itself see below for circular reference decupling for IE6

										
									
Returns:
undefined
setStyle(attr, value) -> pulp.node
Set the css style of a node. Attribute names can be hyphenated (e.g. "z-index") or camelized (e.g. "zIndex"). Optionally an Object with attribute-value pairs may be passed.
  var $ = pulp.node.getInstance;
  $('fruit').setStyle('backgroundColor', 'red');
  $('fruit').setStyle({
    color: 'white',
    'font-weight': 'bold'
  });
Parameters:
{String} attr The attribute name
{String} value The value to set
Returns:
{pulp.node}
getStyle(attr) -> String
Set the css style of a node. Attribute names can be hyphenated (e.g. "z-index") or camelized (e.g. "zIndex"). Optionally an Object with attribute-value pairs may be passed.

										
									
Parameters:
{String} attr The attribute name
Returns:
{String}
setOpacity(A) -> pulp.node
Set the opacity style

										
									
Parameters:
{String|Number} A number between 0 and 1. 1 for fully visible, 0.5 for 50% opacity, 0 for invisible
Returns:
{pulp.node}
getOpacity() -> Number
Get the opacity style

										
									
Returns:
{Number} A number between 0 and 1. 1 for fully visible, 0.5 for 50% opacity, 0 for invisible
get(property) -> Mixed
Get the raw value of any given property (e.g. innerHTML, style, title, value, parentNode, etc.)

										
									
Parameters:
{String} property
Returns:
{Mixed}
set(property, value) -> pulp.node
Set the raw value of any given property (e.g. innerHTML, style, title, value, parentNode, etc.)

										
									
Parameters:
{String} property
{Mixed} value
Returns:
{pulp.node}
html(html) -> pulp.node
Get or set the innerHTML (sets when argument is present, gets when argument is absent)

										
									
Parameters:
{String|HTMLElement} html An html string or an html node
Returns:
{pulp.node}
hasClass(className) -> Boolean
Return true if the node has the given css class name (aliased as hasClassName)

										
									
Parameters:
{String} className
Returns:
{Boolean}
addClass(className) -> pulp.node
Add a css class name to the node (aliased as addClassName)

										
									
Parameters:
{String} className
Returns:
{pulp.node}
removeClass(className) -> this
Remove a css class name from the node (aliased as removeClassName)

										
									
Parameters:
{String} className
Returns:
{this}
toggleClass(className, onOff)
Remove a css class if present or add if not pressent

										
									
Parameters:
{String} className The name of the css class
{Object} onOff If undefined, do a regular toggle. If true add class, if false remove it
hide() -> this
set display style to none to visually hide the node

										
									
Returns:
{this}
show() -> this
Set display style to an empty string

										
									
Returns:
{this}
remove() -> this
Remove the node from the document tree

										
									
Returns:
{this}
replace(node) -> this
Replace a DOM node

										
									
Parameters:
{HTMLElement|pulp.node} node Node to add instead of this one
Returns:
{this} The replaced node
prependChild(child) -> pulp.node
Add a new child to this node as the first child

										
									
Parameters:
child
Returns:
{pulp.node}
appendChild(child) -> pulp.node
Add a new child to this node as the last child

										
									
Parameters:
child
Returns:
{pulp.node}
replaceChild(newEl, oldEl) -> pulp.node
Replace child with another element

										
									
Parameters:
{HTMLElement|pulp.node} newEl
{HTMLElement|pulp.node} oldEl
Returns:
{pulp.node} The newly inserted node
insertBefore(child) -> pulp.node
Add a node immediately before this one

										
									
Parameters:
child
Returns:
{pulp.node}
insertAfter(child) -> pulp.node
Add a node immediately after this one

										
									
Parameters:
child
Returns:
{pulp.node}
wrap(wrapper [, deepest=true]) -> pulp.node
Wrap a node in HTML or another node

										
									
Parameters:
{String|HTMLElement|pulp.node} wrapper The HTML or node to wrap around this node
{Boolean} deepest?, Default: true If true, append to the deepest child of the wrapper
Returns:
{pulp.node} The new wrapper
wrapInner(wrapper [, deepest=true]) -> pulp.node
Move all child nodes into a new wrapper

										
									
Parameters:
{String|HTMLElement|pulp.node} wrapper The HTML or node to wrap around this node's children
{Boolean} deepest?, Default: true If true, append to the deepest child of the wrapper
Returns:
{pulp.node} The new wrapper
getDeepestChild() -> pulp.node
Return the first node at the deepest level
  var p = $('

'); var span = p.getDeepestChild();
Returns:
{pulp.node}
getChildren() -> pulp.node[]
Get an array of child nodes as pulp.node objects

										
									
Returns:
{pulp.node[]}
getPrevSibling() -> Boolean|pulp.node
Get the sibling that comes immediately before this one

										
									
Returns:
{Boolean|pulp.node}
getNextSibling() -> Boolean|pulp.node
Get the sibling that comes immediately after this one

										
									
Returns:
{Boolean|pulp.node}
getSiblings() -> pulp.node[]
Get an array of all siblings as pulp.node objects (don't include this node)

										
									
Returns:
{pulp.node[]}
getNextSiblings() -> pulp.node[]
Get an array of siblings as pulp.node objects that come after this node

										
									
Returns:
{pulp.node[]}
getPreviousSiblings() -> pulp.node[]
Get an array of siblings as pulp.node objects that come before this node

										
									
Returns:
{pulp.node[]}
getAncestors() -> pulp.node[]
Get an array of ancestors of this node as pulp.node objects

										
									
Returns:
{pulp.node[]}
up([selector=""]) -> pulp.node
Get the first ancestor matching the given tag name, index, or css selector

										
									
Parameters:
{String|Number} selector?, Default: "" A tag name, index or a css selector (pulp.cssQuery is required to use css selectors) - When a tag name is given, it returns the first ancestor with that tag name - When a number is given, it returns the ancestor with that index (1 for parent, 2 for grandparent, etc.) - When a selector is given, the first ancestor matching the selector is given (assuming pulp.cssQuery is present)
Returns:
{pulp.node}
down([idx=""]) -> pulp.node
Get the first descendant matching the given tag name, index, or css selector

										
									
Parameters:
{String|Number} idx?, Default: "" A tag name, index or a css selector (pulp.cssQuery is required to use css selectors) - When a tag name is given, it returns the first descendant with that tag name - When a number is given, it returns the descendant with that index (1 for first child, 2 for first child's first child, etc.) - When a selector is given, the first descendant matching the selector is given (assuming pulp.cssQuery is present)
Returns:
{pulp.node}
isDescendantOf(parent) -> Boolean
Return true if the node is a descendent of the given node

										
									
Parameters:
{pulp.node|HTMLElement} parent The parent to test against
Returns:
{Boolean}
identify() -> String
Get the id attribute of a node. If id is not set, set it. Account for situations where id property is not a string such as a form with an input named "id"

										
									
Returns:
{String}
getDimensions() -> Object
Get the height and width of the node in px

										
									
Returns:
{Object} Object with properties "width" and "height"
getHeight() -> Number
Get the height of the node in px

										
									
Returns:
{Number}
getWidth() -> Number
Get the width of the node in px

										
									
Returns:
{Number}
cloneNode(withChildren) -> pulp.node
Return a copy of the pulp.node being sure to remove the clone's id attribute. If a deep copy, remove the id attribute from children as well. Remember that the copy is not attached to the DOM tree. TODO: delete the event handlers that IE erroneously adds to the copied node

										
									
Parameters:
{Boolean} withChildren If true, perform a deep copy
Returns:
{pulp.node}
setAttribute(attr, The) -> undefined
Set an attribute on a node

										
									
Parameters:
{String} attr The attribute to set
{String|undefined|false|null} The value of the attribute. If not given, the attribute will be set to the atribute name. e.g. $(el).setAttribute('checked') will set checked="checked" If false or null, the attribute is removed
Returns:
{undefined}
getAttribute(attr) -> String|Number
Return the value of the specified attribute (special treatment for IE)

										
									
Parameters:
{String} attr The attribute to get
Returns:
{String|Number}
hasAttribute(attr)

										
									
Parameters:
attr
removeAttribute(attribute) -> pulp.node
Remove the given attribute

										
									
Parameters:
{String} attribute The name of the attribute to remove
Returns:
{pulp.node}
offsetParent() -> pulp.node
Return the first ancestor with offset of static (or body if none ar found)

										
									
Returns:
{pulp.node}
pulp.node.getInstance(The) -> pulp.node|undefined
Return a new pulp.node by node id or node handle

										
									
Parameters:
{String|HTMLElement|pulp.node} The id or node handle to get
Returns:
{pulp.node|undefined} Returns undefined if the node cannot be found
pulp.node.htmlToNodeList(html, doc) -> HTMLNodeList
Convert an html string to an HTMLNodelist object

										
									
Parameters:
{String} html
doc
Returns:
{HTMLNodeList}
pulp.node._camelize(Thes) -> String
Convert a hyphen-delimited string to a camelCase string

										
									
Parameters:
{String} Thes string to convert
Returns:
{String}
pulp.node.styleStringToObject(CSS) -> Object
Convert a CSS style string to an object

										
									
Parameters:
{String} CSS stylesheet style string
Returns:
{Object}
readAttribute()

										
									
writeAttribute()

										
									
addClassName()

										
									
removeClassName()

										
									
hasClassName()

										
									
wrapChildren()

										
									
replaceNode()

										
									
Documentation generated by JsDoc Toolkit 2.1.0 on Tue Aug 18 2009 22:40:30; Template based on jProton by Pedro Simonetti