* `applyProjectionRecursive` performs operation on the projection specified by `action` (insert, * detach, destroy) * * Inserting a projection requires us to locate the projected nodes from the parent component. The * complication is that those nodes themselves could be re-projected from their p
( renderer: Renderer, action: WalkTNodeTreeAction, lView: LView, tProjectionNode: TProjectionNode, parentRElement: RElement | null, beforeNode: RNode | null, )
| 938 | * @param beforeNode Before which node the insertions should happen. |
| 939 | */ |
| 940 | function applyProjectionRecursive( |
| 941 | renderer: Renderer, |
| 942 | action: WalkTNodeTreeAction, |
| 943 | lView: LView, |
| 944 | tProjectionNode: TProjectionNode, |
| 945 | parentRElement: RElement | null, |
| 946 | beforeNode: RNode | null, |
| 947 | ) { |
| 948 | const componentLView = lView[DECLARATION_COMPONENT_VIEW]; |
| 949 | const componentNode = componentLView[T_HOST] as TElementNode; |
| 950 | ngDevMode && |
| 951 | assertEqual(typeof tProjectionNode.projection, 'number', 'expecting projection index'); |
| 952 | const nodeToProjectOrRNodes = componentNode.projection![tProjectionNode.projection]!; |
| 953 | if (Array.isArray(nodeToProjectOrRNodes)) { |
| 954 | // This should not exist, it is a bit of a hack. When we bootstrap a top level node and we |
| 955 | // need to support passing projectable nodes, so we cheat and put them in the TNode |
| 956 | // of the Host TView. (Yes we put instance info at the T Level). We can get away with it |
| 957 | // because we know that TView is not shared and therefore it will not be a problem. |
| 958 | // This should be refactored and cleaned up. |
| 959 | for (let i = 0; i < nodeToProjectOrRNodes.length; i++) { |
| 960 | const rNode = nodeToProjectOrRNodes[i]; |
| 961 | applyToElementOrContainer( |
| 962 | action, |
| 963 | renderer, |
| 964 | lView[INJECTOR], |
| 965 | parentRElement, |
| 966 | rNode, |
| 967 | tProjectionNode, |
| 968 | beforeNode, |
| 969 | lView, |
| 970 | ); |
| 971 | } |
| 972 | } else { |
| 973 | let nodeToProject: TNode | null = nodeToProjectOrRNodes; |
| 974 | const projectedComponentLView = componentLView[PARENT] as LView; |
| 975 | // If a parent <ng-content> is located within a skip hydration block, |
| 976 | // annotate an actual node that is being projected with the same flag too. |
| 977 | if (hasInSkipHydrationBlockFlag(tProjectionNode)) { |
| 978 | nodeToProject.flags |= TNodeFlags.inSkipHydrationBlock; |
| 979 | } |
| 980 | applyNodes( |
| 981 | renderer, |
| 982 | action, |
| 983 | nodeToProject, |
| 984 | projectedComponentLView, |
| 985 | parentRElement, |
| 986 | beforeNode, |
| 987 | true, |
| 988 | ); |
| 989 | } |
| 990 | } |
| 991 | |
| 992 | /** |
| 993 | * `applyContainer` performs an operation on the container and its views as specified by |
no test coverage detected
searching dependent graphs…