(element)
| 516 | } |
| 517 | |
| 518 | function getAllChildElements(element) { |
| 519 | let childElements = []; |
| 520 | |
| 521 | // Get all direct child elements of the current element |
| 522 | let children = element.children; |
| 523 | if (children?.length) { |
| 524 | childElements = childElements.concat(Array.from(children)); |
| 525 | |
| 526 | // Loop through each child element |
| 527 | for (let child of children) { |
| 528 | // Recursively call the function to get all descendants of the child element |
| 529 | let descendants = getAllChildElements(child); |
| 530 | |
| 531 | // Add the descendants to the array |
| 532 | childElements = childElements.concat(descendants); |
| 533 | } |
| 534 | } |
| 535 | |
| 536 | return childElements; |
| 537 | } |
| 538 | |
| 539 | function getAllParentElements(element) { |
| 540 | let parentElements = []; |
no test coverage detected