(node: RNode, doc: () => Document)
| 506 | } |
| 507 | |
| 508 | function getStyleHost(node: RNode, doc: () => Document): Node { |
| 509 | const rootNode = node.getRootNode?.(); |
| 510 | |
| 511 | if (documentSupported && rootNode instanceof Document) { |
| 512 | return rootNode.head; // Connected to document. |
| 513 | } else if (!rootNode) { |
| 514 | return doc().head; // `getRootNode` not supported, Node.js use case. |
| 515 | } else if (shadowRootSupported && rootNode instanceof ShadowRoot) { |
| 516 | return rootNode; // Shadow root |
| 517 | } else { |
| 518 | return doc().head; // Disconnected element, use fallback document. |
| 519 | } |
| 520 | } |
| 521 | |
| 522 | function getRootTViewTemplate( |
| 523 | creationBindings: Binding[] | null, |
no test coverage detected