()
| 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) => { |
nothing calls this directly
no test coverage detected