(node: RNode, doc: () => Document)
| 544 | } |
| 545 | |
| 546 | function getStyleHost(node: RNode, doc: () => Document): Node { |
| 547 | const rootNode = node.getRootNode?.(); |
| 548 | |
| 549 | if (documentSupported && rootNode instanceof Document) { |
| 550 | return rootNode.head; // Connected to document. |
| 551 | } else if (!rootNode) { |
| 552 | return doc().head; // `getRootNode` not supported, Node.js use case. |
| 553 | } else if (shadowRootSupported && rootNode instanceof ShadowRoot) { |
| 554 | return rootNode; // Shadow root |
| 555 | } else { |
| 556 | return doc().head; // Disconnected element, use fallback document. |
| 557 | } |
| 558 | } |
| 559 | |
| 560 | function getRootTViewTemplate( |
| 561 | creationBindings: Binding[] | null, |
no test coverage detected