* Iterates over all context nodes that are contained within the specified * `node`. Only iterates over known context nodes. * * @param {Node} node * @param {function(ContextNode<?>):void} callback * @param {boolean=} includeSelf
(node, callback, includeSelf = true)
| 501 | * @param {boolean=} includeSelf |
| 502 | */ |
| 503 | function forEachContained(node, callback, includeSelf = true) { |
| 504 | const closest = ContextNode.closest(node, includeSelf); |
| 505 | if (!closest) { |
| 506 | return; |
| 507 | } |
| 508 | if (closest.node == node) { |
| 509 | callback(closest); |
| 510 | } else if (closest.children) { |
| 511 | for (const child of closest.children) { |
| 512 | if (node.contains(child.node)) { |
| 513 | callback(child); |
| 514 | } |
| 515 | } |
| 516 | } |
| 517 | } |
| 518 | |
| 519 | /** |
| 520 | * @param {Node} node |
no test coverage detected