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

Function createAnchorNode

packages/core/src/linker/view_container_ref.ts:722–742  ·  view source on GitHub ↗

* Regular creation mode: an anchor is created and * assigned to the `lContainer[NATIVE]` slot.

(
  lContainer: LContainer,
  hostLView: LView,
  hostTNode: TNode,
  slotValue: any,
)

Source from the content-addressed store, hash-verified

720 * assigned to the `lContainer[NATIVE]` slot.
721 */
722function createAnchorNode(
723 lContainer: LContainer,
724 hostLView: LView,
725 hostTNode: TNode,
726 slotValue: any,
727) {
728 // We already have a native element (anchor) set, return.
729 if (lContainer[NATIVE]) return;
730
731 let commentNode: RComment;
732 // If the host is an element container, the native host element is guaranteed to be a
733 // comment and we can reuse that comment as anchor element for the new LContainer.
734 // The comment node in question is already part of the DOM structure so we don't need to append
735 // it again.
736 if (hostTNode.type & TNodeType.ElementContainer) {
737 commentNode = unwrapRNode(slotValue) as RComment;
738 } else {
739 commentNode = insertAnchorNode(hostLView, hostTNode);
740 }
741 lContainer[NATIVE] = commentNode;
742}
743
744/**
745 * Hydration logic that looks up all dehydrated views in this container

Callers 1

locateOrCreateAnchorNodeFunction · 0.70

Calls 2

unwrapRNodeFunction · 0.90
insertAnchorNodeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…