(node)
| 474 | function compactQueryNodes(snapshot) { |
| 475 | const nodes = []; |
| 476 | const visit = (node) => { |
| 477 | if (!node || typeof node !== "object") { |
| 478 | return; |
| 479 | } |
| 480 | if ( |
| 481 | "role" in node || |
| 482 | "id" in node || |
| 483 | "label" in node || |
| 484 | "value" in node || |
| 485 | "frame" in node |
| 486 | ) { |
| 487 | nodes.push(node); |
| 488 | } |
| 489 | for (const child of Array.isArray(node.children) ? node.children : []) { |
| 490 | visit(child); |
| 491 | } |
| 492 | }; |
| 493 | for (const match of Array.isArray(snapshot) ? snapshot : []) { |
| 494 | visit(match); |
| 495 | } |