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

Method scanNextNode_

extensions/amp-bind/0.1/bind-impl.js:880–899  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

878 // Helper function for scanning the tree walker's next node.
879 // Returns true if the walker has no more nodes.
880 const scanNextNode_ = () => {
881 const node = walker.currentNode;
882 // If `node` is a Document, it will be scanned first (despite
883 // NodeFilter.SHOW_ELEMENT). Skip it.
884 if (node.nodeType !== Node.ELEMENT_NODE) {
885 return !walker.nextNode();
886 }
887 const element = dev().assertElement(node);
888 const remainingQuota = limit - bindings.length;
889 if (this.scanElement_(element, remainingQuota, bindings)) {
890 limitExceeded = true;
891 }
892 // Elements in FAST_RESCAN_TAGS opt-out of "slow" tree walking in favor of
893 // rescan() with {fast: true} for better performance. Note that only
894 // children are opted-out (e.g. amp-list children, not amp-list itself).
895 const next = FAST_RESCAN_TAGS.includes(node.nodeName)
896 ? walker.skipSubtree()
897 : walker.nextNode();
898 return !next || limitExceeded;
899 };
900
901 return new Promise((resolve) => {
902 const chunktion = (idleDeadline) => {

Callers

nothing calls this directly

Calls 5

scanElement_Method · 0.95
devFunction · 0.90
nextNodeMethod · 0.80
assertElementMethod · 0.80
skipSubtreeMethod · 0.80

Tested by

no test coverage detected