(node: RNode, doc: () => Document)
| 518 | } |
| 519 | |
| 520 | function getStyleHost(node: RNode, doc: () => Document): Node { |
| 521 | const rootNode = node.getRootNode?.(); |
| 522 | |
| 523 | if (documentSupported && rootNode instanceof Document) { |
| 524 | return rootNode.head; // Connected to document. |
| 525 | } else if (!rootNode) { |
| 526 | return doc().head; // `getRootNode` not supported, Node.js use case. |
| 527 | } else if (shadowRootSupported && rootNode instanceof ShadowRoot) { |
| 528 | return rootNode; // Shadow root |
| 529 | } else { |
| 530 | return doc().head; // Disconnected element, use fallback document. |
| 531 | } |
| 532 | } |
| 533 | |
| 534 | function getRootTViewTemplate( |
| 535 | creationBindings: Binding[] | null, |
no test coverage detected