* 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)
| 1663 | * because the node representing the outlet is a comment. |
| 1664 | */ |
| 1665 | function closestTableSection(outlet: RowOutlet, section: string): HTMLElement | null { |
| 1666 | const uppercaseSection = section.toUpperCase(); |
| 1667 | let current: Node | null = outlet.viewContainer.element.nativeElement; |
| 1668 | |
| 1669 | while (current) { |
| 1670 | // 1 is an element node. |
| 1671 | const nodeName = current.nodeType === 1 ? (current as HTMLElement).nodeName : null; |
| 1672 | if (nodeName === uppercaseSection) { |
| 1673 | return current as HTMLElement; |
| 1674 | } else if (nodeName === 'TABLE') { |
| 1675 | // Stop traversing past the `table` node. |
| 1676 | break; |
| 1677 | } |
| 1678 | current = current.parentNode; |
| 1679 | } |
| 1680 | |
| 1681 | return null; |
| 1682 | } |
no outgoing calls
no test coverage detected