* Finds the closest table section to an outlet. We can't use `HTMLElement.closest` for this, * because the node representing the outlet is a comment.
(outlet: RowOutlet, section: string)
| 1681 | * because the node representing the outlet is a comment. |
| 1682 | */ |
| 1683 | function closestTableSection(outlet: RowOutlet, section: string): HTMLElement | null { |
| 1684 | const uppercaseSection = section.toUpperCase(); |
| 1685 | let current: Node | null = outlet.viewContainer.element.nativeElement; |
| 1686 | |
| 1687 | while (current) { |
| 1688 | // 1 is an element node. |
| 1689 | const nodeName = current.nodeType === 1 ? (current as HTMLElement).nodeName : null; |
| 1690 | if (nodeName === uppercaseSection) { |
| 1691 | return current as HTMLElement; |
| 1692 | } else if (nodeName === 'TABLE') { |
| 1693 | // Stop traversing past the `table` node. |
| 1694 | break; |
| 1695 | } |
| 1696 | current = current.parentNode; |
| 1697 | } |
| 1698 | |
| 1699 | return null; |
| 1700 | } |
no outgoing calls
no test coverage detected