MCPcopy Create free account
hub / github.com/angular/angular / applyNodes

Function applyNodes

packages/core/src/render3/node_manipulation.ts:760–855  ·  view source on GitHub ↗

* Performs the operation of `action` on the node. Typically this involves inserting or removing * nodes on the LView or projection boundary.

(
  renderer: Renderer,
  action: WalkTNodeTreeAction,
  tNode: TNode | null,
  lView: LView,
  parentRElement: RElement | null,
  beforeNode: RNode | null,
  isProjection: boolean,
)

Source from the content-addressed store, hash-verified

758 * nodes on the LView or projection boundary.
759 */
760function applyNodes(
761 renderer: Renderer,
762 action: WalkTNodeTreeAction,
763 tNode: TNode | null,
764 lView: LView,
765 parentRElement: RElement | null,
766 beforeNode: RNode | null,
767 isProjection: boolean,
768) {
769 while (tNode != null) {
770 ngDevMode && assertTNodeForLView(tNode, lView);
771 const injector = lView[INJECTOR];
772
773 // Let declarations don't have corresponding DOM nodes so we skip over them.
774 if (tNode.type === TNodeType.LetDeclaration) {
775 tNode = tNode.next;
776 continue;
777 }
778
779 ngDevMode &&
780 assertTNodeType(
781 tNode,
782 TNodeType.AnyRNode | TNodeType.AnyContainer | TNodeType.Projection | TNodeType.Icu,
783 );
784 const rawSlotValue = lView[tNode.index];
785 const tNodeType = tNode.type;
786 if (isProjection) {
787 if (action === WalkTNodeTreeAction.Create) {
788 rawSlotValue && attachPatchData(unwrapRNode(rawSlotValue), lView);
789 tNode.flags |= TNodeFlags.isProjected;
790 }
791 }
792 if (!isDetachedByI18n(tNode)) {
793 if (tNodeType & TNodeType.ElementContainer) {
794 applyNodes(renderer, action, tNode.child, lView, parentRElement, beforeNode, false);
795 applyToElementOrContainer(
796 action,
797 renderer,
798 injector,
799 parentRElement,
800 rawSlotValue,
801 tNode,
802 beforeNode,
803 lView,
804 );
805 } else if (tNodeType & TNodeType.Icu) {
806 const nextRNode = icuContainerIterate(tNode as TIcuContainerNode, lView);
807 let rNode: RNode | null;
808 while ((rNode = nextRNode())) {
809 applyToElementOrContainer(
810 action,
811 renderer,
812 injector,
813 parentRElement,
814 rNode,
815 tNode,
816 beforeNode,
817 lView,

Callers 2

applyViewFunction · 0.85
applyProjectionRecursiveFunction · 0.85

Calls 8

assertTNodeForLViewFunction · 0.90
assertTNodeTypeFunction · 0.90
attachPatchDataFunction · 0.90
unwrapRNodeFunction · 0.90
isDetachedByI18nFunction · 0.90
icuContainerIterateFunction · 0.90
applyProjectionRecursiveFunction · 0.85

Tested by

no test coverage detected