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

Function applyNodes

packages/core/src/render3/node_manipulation.ts:784–879  ·  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

782 * nodes on the LView or projection boundary.
783 */
784function applyNodes(
785 renderer: Renderer,
786 action: WalkTNodeTreeAction,
787 tNode: TNode | null,
788 lView: LView,
789 parentRElement: RElement | null,
790 beforeNode: RNode | null,
791 isProjection: boolean,
792) {
793 while (tNode != null) {
794 ngDevMode && assertTNodeForLView(tNode, lView);
795 const injector = lView[INJECTOR];
796
797 // Let declarations don't have corresponding DOM nodes so we skip over them.
798 if (tNode.type === TNodeType.LetDeclaration) {
799 tNode = tNode.next;
800 continue;
801 }
802
803 ngDevMode &&
804 assertTNodeType(
805 tNode,
806 TNodeType.AnyRNode | TNodeType.AnyContainer | TNodeType.Projection | TNodeType.Icu,
807 );
808 const rawSlotValue = lView[tNode.index];
809 const tNodeType = tNode.type;
810 if (isProjection) {
811 if (action === WalkTNodeTreeAction.Create) {
812 rawSlotValue && attachPatchData(unwrapRNode(rawSlotValue), lView);
813 tNode.flags |= TNodeFlags.isProjected;
814 }
815 }
816 if (!isDetachedByI18n(tNode)) {
817 if (tNodeType & TNodeType.ElementContainer) {
818 applyNodes(renderer, action, tNode.child, lView, parentRElement, beforeNode, false);
819 applyToElementOrContainer(
820 action,
821 renderer,
822 injector,
823 parentRElement,
824 rawSlotValue,
825 tNode,
826 beforeNode,
827 lView,
828 );
829 } else if (tNodeType & TNodeType.Icu) {
830 const nextRNode = icuContainerIterate(tNode as TIcuContainerNode, lView);
831 let rNode: RNode | null;
832 while ((rNode = nextRNode())) {
833 applyToElementOrContainer(
834 action,
835 renderer,
836 injector,
837 parentRElement,
838 rNode,
839 tNode,
840 beforeNode,
841 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