TreeWalker.nextNode()
method moves the current
节点
to the next
visible
node in the document order, and returns the found node. It also moves the current node to this one. If no such node exists, returns
null
and the current node is not changed.
node = treeWalker.nextNode();
var treeWalker = document.createTreeWalker(
document.body,
NodeFilter.SHOW_ELEMENT,
{ acceptNode: function(node) { return NodeFilter.FILTER_ACCEPT; } },
false
);
var node = treeWalker.nextNode(); // returns the first child of root, as it is the next node in document order
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
nextNode
|
Chrome 1 | Edge 12 | Firefox 4 | IE 9 | Opera 9 | Safari 3 | WebView Android 3 | Chrome Android Yes | Firefox Android 4 | Opera Android 10.1 | Safari iOS 3 | Samsung Internet Android Yes |
完整支持
TreeWalker
interface it belongs to.
TreeWalker
AbortController
AbortSignal
AbstractRange
Attr
ByteString
CDATASection
CSSPrimitiveValue
CSSValue
CSSValueList
CharacterData
ChildNode
注释
CustomEvent
DOMConfiguration
DOMError
DOMErrorHandler
DOMException
DOMImplementation
DOMImplementationList
DOMImplementationRegistry
DOMImplementationSource
DOMLocator
DOMObject
DOMParser
DOMPoint
DOMPointInit
DOMPointReadOnly
DOMRect
DOMString
DOMTimeStamp
DOMTokenList
DOMUserData
Document
DocumentFragment
DocumentType
元素
ElementTraversal
Entity
EntityReference
事件
EventTarget
HTMLCollection
MutationObserver
节点
NodeFilter
NodeIterator
NodeList
NonDocumentTypeChildNode
ProcessingInstruction
PromiseResolver
范围
StaticRange
文本
TextDecoder
TextEncoder
TimeRanges
TypeInfo
USVString
UserDataHandler
XMLDocument