MCPcopy Create free account
hub / github.com/ampproject/amphtml / nextNode

Method nextNode

extensions/amp-bind/0.1/bind-impl.js:1831–1848  ·  view source on GitHub ↗

* Finds the next node in document order, if it exists. Returns that node, or null if it doesn't exist. * Updates currentNode, if it exists, else currentNode stays the same. * * @return {?Node}

()

Source from the content-addressed store, hash-verified

1829 * @return {?Node}
1830 */
1831 nextNode() {
1832 if (this.useQuerySelector_) {
1833 if (this.index_ == this.nodeList_.length) {
1834 return null;
1835 }
1836 const next = this.nodeList_[this.index_++];
1837 this.currentNode = next;
1838 return next;
1839 }
1840
1841 const walker = this.treeWalker_;
1842 const next = walker.nextNode();
1843 // This matches the TreeWalker's behavior.
1844 if (next !== null) {
1845 this.currentNode = next;
1846 }
1847 return next;
1848 }
1849
1850 /**
1851 * Skips the remaining sibling nodes in the current parent. Returns the next node in document order.

Callers 3

skipSubtreeMethod · 0.95
scanNextNode_Method · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected