(viewRef: EmbeddedViewRef<any>, _document: Document)
| 13 | * If the root is not an HTML element it gets wrapped in one. |
| 14 | */ |
| 15 | export function getRootNode(viewRef: EmbeddedViewRef<any>, _document: Document): HTMLElement { |
| 16 | const rootNodes: Node[] = viewRef.rootNodes; |
| 17 | |
| 18 | if (rootNodes.length === 1 && rootNodes[0].nodeType === _document.ELEMENT_NODE) { |
| 19 | return rootNodes[0] as HTMLElement; |
| 20 | } |
| 21 | |
| 22 | const wrapper = _document.createElement('div'); |
| 23 | rootNodes.forEach(node => wrapper.appendChild(node)); |
| 24 | return wrapper; |
| 25 | } |
no outgoing calls
no test coverage detected