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

Function applyNodes

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

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