Module: Dojo.dom
Dojo.dom.isNode
Tests whether the specified object is a node
Usage Example:
dojo.dom.isNode(dojo.byId('edtTitle'));
dojo.dom.getUniqueId
Get a unique ID
Usage Example:
dojo.dom.getUniqueId(); //will return dj_unique_#
dojo.dom.firstElement = dojo.dom.getFirstChildElement
Gets the first child node under the specified node that satisfies the specified tag condition
Usage Example:
dojo.dom.firstElement(parentNode, 'SPAN');
dojo.dom.lastElement = dojo.dom.getLastChildElement
Gets the last child node under the specified node that satisfies the specified tag condition
Usage Example:
dojo.dom.lastElement(parentNode, 'SPAN');
dojo.dom.nextElement = dojo.dom.getNextSiblingElement
Gets the next child node that satisfies the specified tag condition for the specified node
Usage Example:
dojo.dom.nextElement(node, 'SPAN');
dojo.dom.prevElement = dojo.dom.getPreviousSiblingElement
Gets the child node of the specified node that satisfies the specified tag condition
Usage Example:
dojo.dom.prevElement(node, 'SPAN');
dojo.dom.moveChildren
Moves all child nodes under the specified node to the target node and returns the number of nodes moved
Usage Example:
dojo.dom.moveChildren(srcNode, destNode, true);//仅移动子节点,srcNode中的文字将被丢弃
dojo.dom.moveChildren(srcNode, destNode, false);//包括文字和子节点都将被移动到目标节点下
dojo.dom.copyChildren
Copies all child nodes under the specified node to the target node and returns the number of replicated nodes
Usage Example:
dojo.dom.moveChildren(srcNode, destNode, true);//仅复制子节点,srcNode中的文字将被忽略
dojo.dom.moveChildren(srcNode, destNode, false);//包括文字和子节点都将被复制到目标节点下
dojo.dom.removeChildren
Deletes all child nodes under the specified node and returns the number of nodes deleted
Usage Example:
Dojo.dom.moveChildren (node);
Dojo.dom.replaceChildren
Replaces all child nodes under the parent node with the specified new node
Usage Example:
dojo.dom.replaceChildren(node, newChild); //目前还不支持newChild为数组形式
dojo.dom.removeNode
Deletes the specified node
Usage Example:
dojo.dom.removeNode(node);
dojo.dom.getAncestors
Returns the collection of parent nodes for the specified node
Usage Example:
dojo.dom.getAncestors(node, null, false);//返回所有的父节点集合(包括指定的节点node)
dojo.dom.getAncestors(node, null, true);//返回最近的一个父节点
dojo.dom.getAncestors(node, function(el){/* 此处增加过滤条件 */return true}, false);//返回所有满足条件的父节点集合
dojo.dom.getAncestorsByTag