MCPcopy Index your code
hub / github.com/angular/angular / getStyleHost

Function getStyleHost

packages/core/src/render3/component_ref.ts:502–514  ·  view source on GitHub ↗
(node: RNode, doc: () => Document)

Source from the content-addressed store, hash-verified

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

Callers 1

createComponentRefMethod · 0.85

Calls 2

docFunction · 0.85
getRootNodeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…