Node

http://www.w3.org/wiki/DOM/domcore/Node


DOM/domcore/Node

DOM‎ | domcore

Node

The Node interface is the primary datatype for the entire DOM. It represents a single node in the document tree. While all objects implementing the Node interface expose methods for dealing with children, not all objects implementing the Node interface may have children. For example, Text nodes may not have children, and adding children to such nodes results in a DOMException being raised.

Attributes

NameDescription
nodeTypeReturns the type of this node.
nodeNameReturns the name of this node.
baseURIReturns the absolute base URI of this node or null if the implementation wasn't able to obtain an absolute URI.
ownerDocumentReturns the top level document object for this node.
parentNodeReturns the parent of this node in the DOM tree.
parentElementReturns the parent element of this node in the DOM tree.
childNodesReturns the child of this node in the DOM tree.
firstChildReturns the first child of this node in the DOM tree.
lastChildReturns the last child of this node in the DOM tree.
previousSiblingReturns the node immediately preceding this node.
nextSiblingReturns the node immediately following this node..
nodeValueReturns the value of this node.
textContentReturns this attribute returns the text content of this node and its descendants.


Methods

NameDescription
hasChildNodes()Returns whether this node has any children.
compareDocumentPosition(other)...
insertBefore(newChild, refChild)Inserts the node newChild before the existing child node refChild.
replaceChild(newChild, oldChild)Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.
removeChild(oldChild)Removes the child node indicated by oldChild from the list of children, and returns it.
appendChild(newChild)Adds the node newChild to the end of the list of children of this node.
cloneNode(deep)...
isSameNode(node)Returns whether this node is the same node as the given one.
lookupPrefix(namespace)Look up the prefix associated to the given namespace URI, starting from this node.
lookupNamespaceURI(prefix)Look up the namespace URI associated to the given prefix, starting from this node.
isDefaultNamespace(namespace)Checks if the specified namespaceURI is the default namespace or not.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值