Namespace MochiKit.DOM
Provides a painless DOM manipulation API.
Defined in: DOM.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Method Attributes | Method Name and Description |
---|---|
<static> |
MochiKit.DOM.attributeArrayNewImpl(node)
Returns an array with DOM node attribute name and value pairs.
|
<static> |
MochiKit.DOM.blurAll(node)
Blurs (unfocuses) a specified DOM node and all relevant child
nodes.
|
<static> |
MochiKit.DOM.childNode(parent, indexOrNode)
Returns an immediate child node from a parent DOM node.
|
<static> |
MochiKit.DOM.createDOMExt(ns, tag, attrs)
Creates a DOM node with a namespace.
|
<static> |
MochiKit.DOM.createDOMFuncExt(ns, tag, args, attrs)
Returns a function for creating a specific kind of DOM nodes.
|
<static> |
MochiKit.DOM.createTextNode(text)
Creates a DOM text node from the specified text.
|
<static> |
MochiKit.DOM.isDOM(obj)
Returns true if the specified object looks like a DOM node.
|
<static> |
MochiKit.DOM.isHTML(obj)
Returns true if the specified object looks like an HTML or XHTML
DOM node.
|
<static> |
MochiKit.DOM.reprDOM(node)
Creates a programmers debug representation of a DOM node.
|
Method Detail
<static>
{Array}
MochiKit.DOM.attributeArrayNewImpl(node)
Returns an array with DOM node attribute name and value pairs.
The name and value pairs are also stored in arrays with two
elements.
- Parameters:
- {Object} node
- the HTML DOM node
- Returns:
- {Array} an array containing attribute name and value pairs (as arrays)
<static>
MochiKit.DOM.blurAll(node)
Blurs (unfocuses) a specified DOM node and all relevant child
nodes. This function will recursively blur all A, BUTTON, INPUT,
TEXTAREA and SELECT child nodes found.
- Parameters:
- {Object} node
- the HTML DOM node
<static>
{Node}
MochiKit.DOM.childNode(parent, indexOrNode)
Returns an immediate child node from a parent DOM node. This
function handles the index range checks and finds the immediate
child node if a descendant node is specified.
- Parameters:
- {Node} parent
- the parent HTML DOM node
- {Number/Node} indexOrNode
- the child index or a descendant node
- Returns:
- {Node} the child HTML DOM node, or null if no matching node was found
<static>
{Object}
MochiKit.DOM.createDOMExt(ns, tag, attrs)
Creates a DOM node with a namespace.
- Parameters:
- {String} ns
- the DOM namespace
- {String} tag
- the DOM tag name
- {Object} attrs Optional
- the node attributes, or null for none
- {Object} ... Optional
- the nodes or text to add as children
- Returns:
- {Object} the DOM node created
<static>
{Function}
MochiKit.DOM.createDOMFuncExt(ns, tag, args, attrs)
Returns a function for creating a specific kind of DOM nodes. The
returned function will optionally require a sequence of non-null
arguments that will be added as attributes to the node creation.
The returned function will otherwise work similar to the
createDOMExt() function, taking attributes and child nodes.
- Parameters:
- {String} ns
- the DOM namespace, or null for HTML
- {String} tag
- the DOM tag name
- {Array} args Optional
- the array with required arguments, or null for no required arguments
- {Object} attrs Optional
- the default node attributes, or null for none
- {Object} ... Optional
- the default nodes or text to add as children
- Returns:
- {Function} the function that creates the DOM nodes
<static>
{Object}
MochiKit.DOM.createTextNode(text)
Creates a DOM text node from the specified text. This is a
convenience function for currentDocument().createTextNode, in
order to be compatible with the withDocument() function.
- Parameters:
- {String} text
- the text content
- Returns:
- {Object} the DOM text node created
<static>
{Boolean}
MochiKit.DOM.isDOM(obj)
Returns true if the specified object looks like a DOM node.
Otherwise, false will be returned. Any non-null object with a
nodeType > 0 will be considered a DOM node by this function.
- Parameters:
- {Object} obj
- the object to check
- Returns:
- {Boolean} true if the object looks like a DOM node, or false otherwise
<static>
{Boolean}
MochiKit.DOM.isHTML(obj)
Returns true if the specified object looks like an HTML or XHTML
DOM node. Otherwise, false will be returned. Any non-null object
with a nodeType > 0 will be considered a DOM node, but only those
with a matching namespaceURI will be considered HTML DOM nodes.
- Parameters:
- {Object} obj
- the object to check
- Returns:
- {Boolean} true if the object looks like an HTML DOM node, or false otherwise
<static>
{String}
MochiKit.DOM.reprDOM(node)
Creates a programmers debug representation of a DOM node. This
method is similar to MochiKit.DOM.emitHtml, except for that it
does not recurse into child nodes.
- Parameters:
- {Object} node
- the HTML DOM node
- Returns:
- {String} a debug representation of the DOM node