2017-12-01 14:23:03 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/**
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * @license
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * Copyright Google Inc. All Rights Reserved.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * Use of this source code is governed by an MIT-style license that can be
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * found in the LICENSE file at https://angular.io/license
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-23 15:23:28 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import {ViewEncapsulation} from '../metadata/view';
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-12 15:02:54 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import {attachPatchData} from './context_discovery';
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-25 20:41:57 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import {callHooks} from './hooks';
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-09 14:54:47 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import {LContainer, NATIVE, VIEWS, unusedValueExportToPlacateAjd as unused1} from './interfaces/container';
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-23 20:00:05 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import {ComponentDef} from './interfaces/definition';
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-21 14:55:37 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import {TContainerNode, TElementContainerNode, TElementNode, TNode, TNodeFlags, TNodeType, TProjectionNode, TViewNode, unusedValueExportToPlacateAjd as unused2} from './interfaces/node';
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-25 15:32:21 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import {unusedValueExportToPlacateAjd as unused3} from './interfaces/projection';
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-06 17:30:48 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import {ProceduralRenderer3, RComment, RElement, RNode, RText, Renderer3, isProceduralRenderer, unusedValueExportToPlacateAjd as unused4} from './interfaces/renderer';
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 21:14:06 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import {CLEANUP, CONTAINER_INDEX, FLAGS, HEADER_OFFSET, HOST_NODE, HookData, LView, LViewFlags, NEXT, PARENT, QUERIES, RENDERER, TVIEW, unusedValueExportToPlacateAjd as unused5} from './interfaces/view';
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import {assertNodeType} from './node_assert';
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-14 15:36:08 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import {findComponentView, getNativeByTNode, isComponent, isLContainer, isRootView, readElementValue, renderStringify} from './util';
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-14 15:03:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-11 13:09:21 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								const unusedValueToPlacateAjd = unused1 + unused2 + unused3 + unused4 + unused5;
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-20 10:47:22 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 21:14:06 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								export function getLContainer(tNode: TViewNode, embeddedView: LView): LContainer|null {
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (tNode.index === -1) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-26 11:39:56 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    // This is a dynamically created view inside a dynamic container.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    // If the host index is -1, the view has not yet been inserted, so it has no parent.
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    const containerHostIndex = embeddedView[CONTAINER_INDEX];
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-11 13:13:57 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    return containerHostIndex > -1 ? embeddedView[PARENT] ![containerHostIndex] : null;
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  } else {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    // This is a inline view node (e.g. embeddedViewStart)
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-11 13:13:57 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    return embeddedView[PARENT] ![tNode.parent !.index] as LContainer;
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-18 18:07:05 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-29 15:08:30 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-01 15:19:27 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								/**
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-12 18:49:00 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * Retrieves render parent for a given view.
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * Might be null if a view is not yet attached to any container.
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-01 15:19:27 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-09 14:20:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								function getContainerRenderParent(tViewNode: TViewNode, view: LView): RElement|null {
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-11 13:13:57 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  const container = getLContainer(tViewNode, view);
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-09 14:20:19 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  return container ? nativeParentNode(view[RENDERER], container[NATIVE]) : null;
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-01 15:19:27 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								const enum WalkTNodeTreeAction {
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-31 15:45:46 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  /** node insert in the native environment */
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-06 17:30:48 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  Insert = 0,
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-31 15:45:46 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  /** node detach from the native environment */
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-06 17:30:48 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  Detach = 1,
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-31 15:45:46 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  /** node destruction using the renderer's API */
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-06 17:30:48 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  Destroy = 2,
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-31 15:45:46 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-03 20:04:36 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/**
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * Stack used to keep track of projection nodes in walkTNodeTree.
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-03 20:04:36 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * This is deliberately created outside of walkTNodeTree to avoid allocating
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-03 20:04:36 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * a new array each time the function is called. Instead the array will be
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * re-used by each invocation. This works because the function is not reentrant.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 21:14:06 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								const projectionNodeStack: (LView | TNode)[] = [];
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-03 20:04:36 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-31 15:45:46 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								/**
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * Walks a tree of TNodes, applying a transformation on the element nodes, either only on the first
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-31 15:45:46 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * one found, or on all of them.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * @param viewToWalk the view to walk
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-12 18:49:00 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * @param action identifies the action to be performed on the elements
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-06 17:30:48 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * @param renderer the current renderer.
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-12 18:49:00 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * @param renderParent Optional the render parent node to be set in all LContainers found,
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-06 17:30:48 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * required for action modes Insert and Destroy.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * @param beforeNode Optional the node before which elements should be added, required for action
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * Insert.
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-31 15:45:46 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								function walkTNodeTree(
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 21:14:06 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    viewToWalk: LView, action: WalkTNodeTreeAction, renderer: Renderer3,
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-12 18:49:00 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    renderParent: RElement | null, beforeNode?: RNode | null) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  const rootTNode = viewToWalk[TVIEW].node as TViewNode;
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-03 20:04:36 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  let projectionNodeIndex = -1;
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  let currentView = viewToWalk;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  let tNode: TNode|null = rootTNode.child as TNode;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  while (tNode) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    let nextTNode: TNode|null = null;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if (tNode.type === TNodeType.Element) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-12 18:49:00 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      executeNodeAction(
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-14 15:36:08 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          action, renderer, renderParent, getNativeByTNode(tNode, currentView), tNode, beforeNode);
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-11 13:13:57 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      const nodeOrContainer = currentView[tNode.index];
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      if (isLContainer(nodeOrContainer)) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        // This element has an LContainer, and its comment needs to be handled
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-14 15:36:08 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        executeNodeAction(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            action, renderer, renderParent, nodeOrContainer[NATIVE], tNode, beforeNode);
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-31 15:45:46 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      }
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    } else if (tNode.type === TNodeType.Container) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-11 13:13:57 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      const lContainer = currentView ![tNode.index] as LContainer;
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-14 15:36:08 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      executeNodeAction(action, renderer, renderParent, lContainer[NATIVE], tNode, beforeNode);
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-11 13:13:57 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      if (lContainer[VIEWS].length) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        currentView = lContainer[VIEWS][0];
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        nextTNode = currentView[TVIEW].node;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-06 17:30:48 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        // When the walker enters a container, then the beforeNode has to become the local native
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        // comment node.
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-11 13:13:57 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        beforeNode = lContainer[NATIVE];
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-06 17:30:48 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      }
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    } else if (tNode.type === TNodeType.Projection) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      const componentView = findComponentView(currentView !);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      const componentHost = componentView[HOST_NODE] as TElementNode;
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      const head: TNode|null =
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          (componentHost.projection as(TNode | null)[])[tNode.projection as number];
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-21 14:55:37 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      if (Array.isArray(head)) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        for (let nativeNode of head) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          executeNodeAction(action, renderer, renderParent, nativeNode, tNode, beforeNode);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      } else {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        // Must store both the TNode and the view because this projection node could be nested
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        // deeply inside embedded views, and we need to get back down to this particular nested
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        // view.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        projectionNodeStack[++projectionNodeIndex] = tNode;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        projectionNodeStack[++projectionNodeIndex] = currentView !;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if (head) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          currentView = componentView[PARENT] !;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          nextTNode = currentView[TVIEW].data[head.index] as TNode;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        }
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      }
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-21 14:55:37 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-25 15:32:21 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    } else {
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      // Otherwise, this is a View or an ElementContainer
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      nextTNode = tNode.child;
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-25 15:32:21 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-02 14:59:31 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if (nextTNode === null) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-03 20:04:36 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      // this last node was projected, we need to get back down to its projection node
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      if (tNode.next === null && (tNode.flags & TNodeFlags.isProjected)) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 21:14:06 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        currentView = projectionNodeStack[projectionNodeIndex--] as LView;
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        tNode = projectionNodeStack[projectionNodeIndex--] as TNode;
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-03 20:04:36 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      }
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      nextTNode = tNode.next;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-06 17:30:48 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      /**
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-12 18:49:00 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								       * Find the next node in the TNode tree, taking into account the place where a node is
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-06 17:30:48 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								       * projected (in the shadow DOM) rather than where it comes from (in the light DOM).
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       *
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       * If there is no sibling node, then it goes to the next sibling of the parent node...
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       * until it reaches rootNode (at which point null is returned).
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								       */
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      while (!nextTNode) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        // If parent is null, we're crossing the view boundary, so we should get the host TNode.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        tNode = tNode.parent || currentView[TVIEW].node;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if (tNode === null || tNode === rootTNode) return null;
							 | 
						
					
						
							
								
									
										
										
										
											2018-07-03 20:04:36 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        // When exiting a container, the beforeNode must be restored to the previous value
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        if (tNode.type === TNodeType.Container) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          currentView = currentView[PARENT] !;
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-11 13:13:57 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          beforeNode = currentView[tNode.index][NATIVE];
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if (tNode.type === TNodeType.View && currentView[NEXT]) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 21:14:06 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          currentView = currentView[NEXT] as LView;
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          nextTNode = currentView[TVIEW].node;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        } else {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          nextTNode = tNode.next;
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-06 17:30:48 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    tNode = nextTNode;
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-06 17:30:48 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/**
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * NOTE: for performance reasons, the possible actions are inlined within the function instead of
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * being passed as an argument.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								function executeNodeAction(
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    action: WalkTNodeTreeAction, renderer: Renderer3, parent: RElement | null,
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-14 15:36:08 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    node: RComment | RElement | RText, tNode: TNode, beforeNode?: RNode | null) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (action === WalkTNodeTreeAction.Insert) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-04 12:08:04 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    nativeInsertBefore(renderer, parent !, node, beforeNode || null);
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  } else if (action === WalkTNodeTreeAction.Detach) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-14 15:36:08 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    nativeRemoveChild(renderer, parent !, node, isComponent(tNode));
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  } else if (action === WalkTNodeTreeAction.Destroy) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-06 17:30:48 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    ngDevMode && ngDevMode.rendererDestroyNode++;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    (renderer as ProceduralRenderer3).destroyNode !(node);
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-25 15:32:21 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-10 20:57:09 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								export function createTextNode(value: any, renderer: Renderer3): RText {
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-12 00:59:48 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  return isProceduralRenderer(renderer) ? renderer.createText(renderStringify(value)) :
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                          renderer.createTextNode(renderStringify(value));
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-10 20:57:09 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 11:04:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								/**
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * Adds or removes all DOM elements associated with a view.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * Because some root nodes of the view may be containers, we sometimes need
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * to propagate deeply into the nested containers to remove all elements in the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * views beneath it.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * @param viewToWalk The view from which elements should be added or removed
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 16:32:21 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * @param insertMode Whether or not elements should be added (if false, removing)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * @param beforeNode The node before which elements should be added, if insert mode
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 11:04:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								export function addRemoveViewFromContainer(
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 21:14:06 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    viewToWalk: LView, insertMode: true, beforeNode: RNode | null): void;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								export function addRemoveViewFromContainer(viewToWalk: LView, insertMode: false): void;
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								export function addRemoveViewFromContainer(
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 21:14:06 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    viewToWalk: LView, insertMode: boolean, beforeNode?: RNode | null): void {
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-12 18:49:00 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  const renderParent = getContainerRenderParent(viewToWalk[TVIEW].node as TViewNode, viewToWalk);
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  ngDevMode && assertNodeType(viewToWalk[TVIEW].node as TNode, TNodeType.View);
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-12 18:49:00 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (renderParent) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    const renderer = viewToWalk[RENDERER];
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-08 10:55:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    walkTNodeTree(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        viewToWalk, insertMode ? WalkTNodeTreeAction.Insert : WalkTNodeTreeAction.Detach, renderer,
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-12 18:49:00 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        renderParent, beforeNode);
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/**
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-19 22:59:58 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * Traverses down and up the tree of views and containers to remove listeners and
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 11:04:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * call onDestroy callbacks.
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * Notes:
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 11:04:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 *  - Because it's used for onDestroy calls, it needs to be bottom-up.
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *  - Must process containers instead of their views to avoid splicing
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *  when views are destroyed and re-added.
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 11:04:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 *  - Using a while loop because it's faster than recursion
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *  - Destroy only called on movement to sibling or movement to parent (laterally or up)
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 11:04:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 16:32:21 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 *  @param rootView The view to destroy
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 21:14:06 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								export function destroyViewTree(rootView: LView): void {
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-30 13:43:14 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  // If the view has no children, we can clean it up and return early.
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-07 22:42:32 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (rootView[TVIEW].childIndex === -1) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-19 22:59:58 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    return cleanUpView(rootView);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 21:14:06 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  let viewOrContainer: LView|LContainer|null = getLViewChild(rootView);
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-08 20:17:13 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  while (viewOrContainer) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 21:14:06 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    let next: LView|LContainer|null = null;
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-07 22:42:32 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if (viewOrContainer.length >= HEADER_OFFSET) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 21:14:06 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      // If LView, traverse down to child.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      const view = viewOrContainer as LView;
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-07 22:42:32 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      if (view[TVIEW].childIndex > -1) next = getLViewChild(view);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    } else {
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 21:14:06 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      // If container, traverse down to its first LView.
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-07 22:42:32 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      const container = viewOrContainer as LContainer;
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-12 08:47:03 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      if (container[VIEWS].length) next = container[VIEWS][0];
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if (next == null) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-07 22:42:32 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      // Only clean up view when moving to the side or up, as destroy hooks
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      // should be called in order from the bottom up.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      while (viewOrContainer && !viewOrContainer ![NEXT] && viewOrContainer !== rootView) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-05 15:28:15 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        cleanUpView(viewOrContainer);
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-08 20:17:13 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        viewOrContainer = getParentState(viewOrContainer, rootView);
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      }
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-05 15:28:15 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      cleanUpView(viewOrContainer || rootView);
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-07 22:42:32 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      next = viewOrContainer && viewOrContainer ![NEXT];
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-08 20:17:13 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    viewOrContainer = next;
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 11:04:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								/**
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * Inserts a view into a container.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 19:34:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * This adds the view to the container's array of active views in the correct
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 11:04:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * position. It also adds the view's elements to the DOM if the container isn't a
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * root node of another view (in that case, the view's elements will be added when
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * the container's parent view is added later).
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-17 14:32:45 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * @param lView The view to insert
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * @param lContainer The container into which the view should be inserted
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * @param parentView The new parent of the inserted view
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 16:32:21 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * @param index The index at which to insert the view
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-17 14:32:45 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * @param containerIndex The index of the container node, if dynamic
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 11:04:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								export function insertView(
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 21:14:06 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    lView: LView, lContainer: LContainer, parentView: LView, index: number,
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-17 14:32:45 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    containerIndex: number) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  const views = lContainer[VIEWS];
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (index > 0) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    // This is a new view, we need to add it to the children.
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-12 08:47:03 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    views[index - 1][NEXT] = lView;
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-08 12:10:20 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (index < views.length) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-12 08:47:03 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    lView[NEXT] = views[index];
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    views.splice(index, 0, lView);
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-08 12:10:20 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  } else {
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-12 08:47:03 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    views.push(lView);
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-26 11:39:56 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    lView[NEXT] = null;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  // Dynamically inserted views need a reference to their parent container's host so it's
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-26 11:39:56 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  // possible to jump from a view to its container's next when walking the node tree.
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (containerIndex > -1) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    lView[CONTAINER_INDEX] = containerIndex;
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-17 14:32:45 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    lView[PARENT] = parentView;
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-28 11:57:36 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  // Notify query that a new view has been added
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-07 22:42:32 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (lView[QUERIES]) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    lView[QUERIES] !.insertView(index);
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-28 11:57:36 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-31 15:45:46 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  // Sets the attached flag
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-26 11:39:56 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  lView[FLAGS] |= LViewFlags.Attached;
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 11:04:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								/**
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-31 15:45:46 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * Detaches a view from a container.
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 11:04:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 19:34:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * This method splices the view from the container's array of active views. It also
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-31 15:45:46 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * removes the view's elements from the DOM.
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 11:04:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-17 14:32:45 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * @param lContainer The container from which to detach a view
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-31 15:45:46 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * @param removeIndex The index of the view to detach
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-17 14:32:45 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * @param detached Whether or not this view is already detached.
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-04 11:56:24 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * @returns Detached LView instance.
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 11:04:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-04 11:56:24 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								export function detachView(lContainer: LContainer, removeIndex: number, detached: boolean): LView {
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-17 14:32:45 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  const views = lContainer[VIEWS];
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-12 08:47:03 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  const viewToDetach = views[removeIndex];
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (removeIndex > 0) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 21:14:06 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    views[removeIndex - 1][NEXT] = viewToDetach[NEXT] as LView;
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 19:34:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  views.splice(removeIndex, 1);
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (!detached) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    addRemoveViewFromContainer(viewToDetach, false);
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-18 16:55:43 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-12 08:47:03 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (viewToDetach[QUERIES]) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    viewToDetach[QUERIES] !.removeView();
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-28 11:57:36 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-12 08:47:03 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  viewToDetach[CONTAINER_INDEX] = -1;
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  viewToDetach[PARENT] = null;
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-31 15:45:46 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  // Unsets the attached flag
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-12 08:47:03 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  viewToDetach[FLAGS] &= ~LViewFlags.Attached;
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-04 11:56:24 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  return viewToDetach;
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-31 15:45:46 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-28 11:57:36 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-31 15:45:46 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								/**
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * Removes a view from a container, i.e. detaches it and then destroys the underlying LView.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-17 14:32:45 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * @param lContainer The container from which to remove a view
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * @param tContainer The TContainer node associated with the LContainer
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-31 15:45:46 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * @param removeIndex The index of the view to remove
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								export function removeView(
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-09 14:47:18 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    lContainer: LContainer, containerHost: TElementNode | TContainerNode | TElementContainerNode,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    removeIndex: number) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-17 14:32:45 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  const view = lContainer[VIEWS][removeIndex];
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-09 14:47:18 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  detachView(lContainer, removeIndex, !!containerHost.detached);
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-24 10:30:29 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  destroyLView(view);
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 21:14:06 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								/** Gets the child of the given LView */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								export function getLViewChild(lView: LView): LView|LContainer|null {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  const childIndex = lView[TVIEW].childIndex;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return childIndex === -1 ? null : lView[childIndex];
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-30 13:43:14 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-31 15:45:46 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								/**
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * A standalone function which destroys an LView,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * conducting cleanup (e.g. removing listeners, calling onDestroys).
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * @param view The view to be destroyed.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 21:14:06 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								export function destroyLView(view: LView) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-07 22:42:32 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  const renderer = view[RENDERER];
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-31 15:45:46 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (isProceduralRenderer(renderer) && renderer.destroyNode) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-12 18:49:00 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    walkTNodeTree(view, WalkTNodeTreeAction.Destroy, renderer, null);
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-31 15:45:46 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  destroyViewTree(view);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // Sets the destroyed flag
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-07 22:42:32 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  view[FLAGS] |= LViewFlags.Destroyed;
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-31 15:45:46 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 11:04:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								/**
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-08 20:17:13 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * Determines which LViewOrLContainer to jump to when traversing back up the
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 11:04:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * tree in destroyViewTree.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-08 20:17:13 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * Normally, the view's parent LView should be checked, but in the case of
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 11:04:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * embedded views, the container (which is the view node's parent, but not the
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-08 20:17:13 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * LView's parent) needs to be checked for a possible next property.
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 11:04:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-08 20:17:13 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * @param state The LViewOrLContainer for which we need a parent state
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 16:32:21 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * @param rootView The rootView, so we don't propagate too far up the view tree
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-08 20:17:13 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * @returns The correct parent LViewOrLContainer
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 11:04:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 21:14:06 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								export function getParentState(state: LView | LContainer, rootView: LView): LView|LContainer|null {
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  let tNode;
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 21:14:06 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (state.length >= HEADER_OFFSET && (tNode = (state as LView) ![HOST_NODE]) &&
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      tNode.type === TNodeType.View) {
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    // if it's an embedded view, the state needs to go up to the container, in case the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    // container has a next
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 21:14:06 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    return getLContainer(tNode as TViewNode, state as LView) as LContainer;
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  } else {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    // otherwise, use parent view for containers or component views
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-07 22:42:32 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    return state[PARENT] === rootView ? null : state[PARENT];
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 11:04:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								/**
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-14 15:11:14 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * Calls onDestroys hooks for all directives and pipes in a given view and then removes all
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * listeners. Listeners are removed as the last step so events delivered in the onDestroys hooks
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * can be propagated to @Output listeners.
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 11:04:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 21:14:06 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * @param view The LView to clean up
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 11:04:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 21:14:06 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								function cleanUpView(viewOrContainer: LView | LContainer): void {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if ((viewOrContainer as LView).length >= HEADER_OFFSET) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    const view = viewOrContainer as LView;
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-05 15:28:15 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    executeOnDestroys(view);
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-14 15:11:14 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    removeListeners(view);
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-10 23:40:19 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    const hostTNode = view[HOST_NODE];
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-05 15:28:15 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    // For component views only, the local renderer is destroyed as clean up time.
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-10 23:40:19 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if (hostTNode && hostTNode.type === TNodeType.Element && isProceduralRenderer(view[RENDERER])) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-05 15:28:15 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      ngDevMode && ngDevMode.rendererDestroy++;
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-07 22:42:32 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      (view[RENDERER] as ProceduralRenderer3).destroy();
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-05 15:28:15 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-22 17:40:59 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-23 10:57:48 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/** Removes listeners and unsubscribes from output subscriptions */
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 21:14:06 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								function removeListeners(lView: LView): void {
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-28 15:54:38 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  const tCleanup = lView[TVIEW].cleanup !;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (tCleanup != null) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    const lCleanup = lView[CLEANUP] !;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    for (let i = 0; i < tCleanup.length - 1; i += 2) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      if (typeof tCleanup[i] === 'string') {
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-05 15:28:15 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        // This is a listener with the native renderer
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-19 15:03:47 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        const idxOrTargetGetter = tCleanup[i + 1];
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        const target = typeof idxOrTargetGetter === 'function' ?
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            idxOrTargetGetter(lView) :
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            readElementValue(lView[idxOrTargetGetter]);
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-28 15:54:38 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        const listener = lCleanup[tCleanup[i + 2]];
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        const useCaptureOrSubIdx = tCleanup[i + 3];
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if (typeof useCaptureOrSubIdx === 'boolean') {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          // DOM listener
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-19 15:03:47 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								          target.removeEventListener(tCleanup[i], listener, useCaptureOrSubIdx);
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-28 15:54:38 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        } else {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          if (useCaptureOrSubIdx >= 0) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            // unregister
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            lCleanup[useCaptureOrSubIdx]();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          } else {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            // Subscription
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            lCleanup[-useCaptureOrSubIdx].unsubscribe();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        }
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-23 10:57:48 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        i += 2;
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-28 15:54:38 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      } else if (typeof tCleanup[i] === 'number') {
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-05 15:28:15 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        // This is a listener with renderer2 (cleanup fn can be found by index)
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-28 15:54:38 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        const cleanupFn = lCleanup[tCleanup[i]];
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-05 15:28:15 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        cleanupFn();
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-23 10:57:48 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      } else {
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-05 15:28:15 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        // This is a cleanup function that is grouped with the index of its context
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-28 15:54:38 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        const context = lCleanup[tCleanup[i + 1]];
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        tCleanup[i].call(context);
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-23 10:57:48 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 21:14:06 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    lView[CLEANUP] = null;
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-23 10:57:48 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/** Calls onDestroy hooks for this view */
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 21:14:06 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								function executeOnDestroys(view: LView): void {
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-07 22:42:32 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  const tView = view[TVIEW];
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-23 10:57:48 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  let destroyHooks: HookData|null;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (tView != null && (destroyHooks = tView.destroyHooks) != null) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-08 16:04:46 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    callHooks(view, destroyHooks);
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-21 15:10:34 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-06 17:46:49 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								/**
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-09 16:33:25 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * Returns a native element if a node can be inserted into the given parent.
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-26 11:39:56 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-22 15:37:38 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * There are two reasons why we may not be able to insert a element immediately.
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-26 11:39:56 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * - Projection: When creating a child content element of a component, we have to skip the
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-22 15:37:38 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 *   insertion because the content of a component will be projected.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *   `<component><content>delayed due to projection</content></component>`
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-26 11:39:56 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * - Parent container is disconnected: This can happen when we are inserting a view into
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 *   parent container, which itself is disconnected. For example the parent container is part
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-23 20:00:05 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 *   of a View which has not be inserted or is made for projection but has not been inserted
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-22 15:37:38 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 *   into destination.
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 11:04:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-09 16:33:25 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								function getRenderParent(tNode: TNode, currentView: LView): RElement|null {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // Nodes of the top-most view can be inserted eagerly.
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-09 11:59:49 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (isRootView(currentView)) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-09 16:33:25 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    return nativeParentNode(currentView[RENDERER], getNativeByTNode(tNode, currentView));
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-09 11:59:49 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-09 16:33:25 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  // Skip over element and ICU containers as those are represented by a comment node and
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // can't be used as a render parent.
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-09 11:59:49 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  const parent = getHighestElementOrICUContainer(tNode).parent;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // If the parent is null, then we are inserting across views: either into an embedded view or a
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // component view.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (parent == null) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    const hostTNode = currentView[HOST_NODE] !;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if (hostTNode.type === TNodeType.View) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-09 16:33:25 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      // We are inserting a root element of an embedded view We might delay insertion of children
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      // for a given view if it is disconnected. This might happen for 2 main reasons:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      // - view is not inserted into any container(view was created but not inserted yet)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      // - view is inserted into a container but the container itself is not inserted into the DOM
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      // (container might be part of projection or child of a view that is not inserted yet).
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      // In other words we can insert children of a given view if this view was inserted into a
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      // container and the container itself has its render parent determined.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      return getContainerRenderParent(hostTNode as TViewNode, currentView);
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-09 11:59:49 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    } else {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      // We are inserting a root element of the component view into the component host element and
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      // it should always be eager.
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-09 16:33:25 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      return getHostNative(currentView);
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-09 11:59:49 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-22 15:37:38 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  } else {
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-09 11:59:49 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    ngDevMode && assertNodeType(parent, TNodeType.Element);
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-09 15:29:08 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if (parent.flags & TNodeFlags.isComponent) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-23 20:00:05 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      const tData = currentView[TVIEW].data;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      const tNode = tData[parent.index] as TNode;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      const encapsulation = (tData[tNode.directiveStart] as ComponentDef<any>).encapsulation;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      // We've got a parent which is an element in the current view. We just need to verify if the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      // parent element is not a component. Component's content nodes are not inserted immediately
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      // because they will be projected, and so doing insert at this point would be wasteful.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      // Since the projection would then move it to its final destination. Note that we can't
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      // make this assumption when using the Shadow DOM, because the native projection placeholders
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      // (<content> or <slot>) have to be in place as elements are being inserted.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      if (encapsulation !== ViewEncapsulation.ShadowDom &&
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								          encapsulation !== ViewEncapsulation.Native) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return null;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      }
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-09 16:33:25 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-23 20:00:05 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return getNativeByTNode(parent, currentView) as RElement;
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-22 15:37:38 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-26 11:36:31 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-09 16:33:25 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								/**
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * Gets the native host element for a given view. Will return null if the current view does not have
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * a host element.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								function getHostNative(currentView: LView): RElement|null {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  const hostTNode = currentView[HOST_NODE];
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return hostTNode && hostTNode.type === TNodeType.Element ?
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      (getNativeByTNode(hostTNode, currentView[PARENT] !) as RElement) :
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      null;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-01 15:19:27 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								/**
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * Inserts a native node before another native node for a given parent using {@link Renderer3}.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * This is a utility function that can be used when native nodes were determined - it abstracts an
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * actual renderer being used.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-17 11:01:35 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								export function nativeInsertBefore(
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-01 15:19:27 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    renderer: Renderer3, parent: RElement, child: RNode, beforeNode: RNode | null): void {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (isProceduralRenderer(renderer)) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    renderer.insertBefore(parent, child, beforeNode);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  } else {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    parent.insertBefore(child, beforeNode, true);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-21 14:55:37 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								function nativeAppendChild(renderer: Renderer3, parent: RElement, child: RNode): void {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (isProceduralRenderer(renderer)) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    renderer.appendChild(parent, child);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  } else {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    parent.appendChild(child);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								function nativeAppendOrInsertBefore(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    renderer: Renderer3, parent: RElement, child: RNode, beforeNode: RNode | null) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (beforeNode) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    nativeInsertBefore(renderer, parent, child, beforeNode);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  } else {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    nativeAppendChild(renderer, parent, child);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-04 12:08:04 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								/**
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * Removes a native child node from a given native parent node.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-14 15:36:08 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								export function nativeRemoveChild(
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    renderer: Renderer3, parent: RElement, child: RNode, isHostElement?: boolean): void {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  isProceduralRenderer(renderer) ? renderer.removeChild(parent as RElement, child, isHostElement) :
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-04 17:17:50 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                   parent.removeChild(child);
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-04 12:08:04 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-17 11:01:35 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								/**
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * Returns a native parent of a given native node.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								export function nativeParentNode(renderer: Renderer3, node: RNode): RElement|null {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return (isProceduralRenderer(renderer) ? renderer.parentNode(node) : node.parentNode) as RElement;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/**
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * Returns a native sibling of a given native node.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								export function nativeNextSibling(renderer: Renderer3, node: RNode): RNode|null {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return isProceduralRenderer(renderer) ? renderer.nextSibling(node) : node.nextSibling;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-26 11:36:31 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								/**
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-21 14:55:37 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * Finds a native "anchor" node for cases where we can't append a native child directly
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * (`appendChild`) and need to use a reference (anchor) node for the `insertBefore` operation.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * @param parentTNode
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * @param lView
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								function getNativeAnchorNode(parentTNode: TNode, lView: LView): RNode|null {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (parentTNode.type === TNodeType.View) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    const lContainer = getLContainer(parentTNode as TViewNode, lView) !;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    const views = lContainer[VIEWS];
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    const index = views.indexOf(lView);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return getBeforeNodeForView(index, views, lContainer[NATIVE]);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  } else if (
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      parentTNode.type === TNodeType.ElementContainer ||
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      parentTNode.type === TNodeType.IcuContainer) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return getNativeByTNode(parentTNode, lView);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  return null;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/**
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * Appends the `child` native node (or a collection of nodes) to the `parent`.
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-26 11:36:31 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-18 16:55:43 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * The element insertion might be delayed {@link canInsertNativeNode}.
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-26 11:36:31 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-21 14:55:37 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * @param childEl The native child (or children) that should be appended
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * @param childTNode The TNode of the child element
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-26 11:36:31 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * @param currentView The current LView
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * @returns Whether or not the child was appended
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-21 14:55:37 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								export function appendChild(childEl: RNode | RNode[], childTNode: TNode, currentView: LView): void {
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-09 16:33:25 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  const renderParent = getRenderParent(childTNode, currentView);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (renderParent != null) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-07 22:42:32 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    const renderer = currentView[RENDERER];
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    const parentTNode: TNode = childTNode.parent || currentView[HOST_NODE] !;
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-21 14:55:37 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    const anchorNode = getNativeAnchorNode(parentTNode, currentView);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if (Array.isArray(childEl)) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      for (let nativeNode of childEl) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        nativeAppendOrInsertBefore(renderer, renderParent, nativeNode, anchorNode);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      }
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-22 15:37:38 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    } else {
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-21 14:55:37 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      nativeAppendOrInsertBefore(renderer, renderParent, childEl, anchorNode);
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-22 15:37:38 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								/**
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-04 17:17:50 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * Gets the top-level element or an ICU container if those containers are nested.
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-04 17:17:50 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * @param tNode The starting TNode for which we should skip element and ICU containers
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * @returns The TNode of the highest level ICU container or element container
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-04 17:17:50 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								function getHighestElementOrICUContainer(tNode: TNode): TNode {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  while (tNode.parent != null && (tNode.parent.type === TNodeType.ElementContainer ||
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                  tNode.parent.type === TNodeType.IcuContainer)) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    tNode = tNode.parent;
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-04 17:17:50 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  return tNode;
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 21:14:06 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								export function getBeforeNodeForView(index: number, views: LView[], containerNative: RComment) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (index + 1 < views.length) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 21:14:06 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    const view = views[index + 1] as LView;
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    const viewTNode = view[HOST_NODE] as TViewNode;
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-12 18:49:00 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    return viewTNode.child ? getNativeByTNode(viewTNode.child, view) : containerNative;
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  } else {
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-11 13:13:57 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    return containerNative;
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-18 16:55:43 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								/**
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-12 18:49:00 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * Removes the `child` element from the DOM if not in view and not projected.
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-18 16:55:43 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-12 18:49:00 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * @param childTNode The TNode of the child to remove
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * @param childEl The child that should be removed
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-18 16:55:43 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * @param currentView The current LView
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * @returns Whether or not the child was removed
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-09 16:33:25 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								export function removeChild(childTNode: TNode, childEl: RNode, currentView: LView): void {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  const parentNative = getRenderParent(childTNode, currentView);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // We only remove the element if it already has a render parent.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  if (parentNative) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-01-04 12:08:04 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    nativeRemoveChild(currentView[RENDERER], parentNative, childEl);
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-18 16:55:43 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 11:04:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								/**
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * Appends a projected node to the DOM, or in the case of a projected container,
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-26 11:36:31 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * appends the nodes from all of the container's active views to the DOM.
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 11:04:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 *
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-11 13:13:57 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * @param projectedTNode The TNode to be projected
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 * @param tProjectionNode The projection (ng-content) TNode
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-08 20:17:13 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * @param currentView Current LView
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-11 13:13:57 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 * @param projectionView Projection view (view above current)
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-13 11:04:46 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 */
							 | 
						
					
						
							
								
									
										
										
										
											2018-01-26 11:36:31 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								export function appendProjectedNode(
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 21:14:06 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    projectedTNode: TNode, tProjectionNode: TNode, currentView: LView,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    projectionView: LView): void {
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-12 18:49:00 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  const native = getNativeByTNode(projectedTNode, projectionView);
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-11 13:13:57 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  appendChild(native, tProjectionNode, currentView);
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-22 16:57:40 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // the projected contents are processed while in the shadow view (which is the currentView)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // therefore we need to extract the view where the host element lives since it's the
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // logical container of the content projected views
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-11 13:13:57 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  attachPatchData(native, projectionView);
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-11 13:13:57 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  const nodeOrContainer = projectionView[projectedTNode.index];
							 | 
						
					
						
							
								
									
										
										
										
											2018-09-13 16:07:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  if (projectedTNode.type === TNodeType.Container) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-27 16:05:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    // The node we are adding is a container and we are adding it to an element which
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-08 11:48:54 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    // is not a component (no more re-projection).
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    // Alternatively a container is projected at the root of a component's template
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    // and can't be re-projected (as not content of any component).
							 | 
						
					
						
							
								
									
										
										
										
											2018-06-27 16:05:23 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    // Assign the final projection location in those cases.
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-11 13:13:57 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    const views = nodeOrContainer[VIEWS];
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    for (let i = 0; i < views.length; i++) {
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-11 13:13:57 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								      addRemoveViewFromContainer(views[i], true, nodeOrContainer[NATIVE]);
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2018-10-11 13:13:57 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  } else {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if (projectedTNode.type === TNodeType.ElementContainer) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      let ngContainerChildTNode: TNode|null = projectedTNode.child as TNode;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      while (ngContainerChildTNode) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        appendProjectedNode(ngContainerChildTNode, tProjectionNode, currentView, projectionView);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        ngContainerChildTNode = ngContainerChildTNode.next;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if (isLContainer(nodeOrContainer)) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								      appendChild(nodeOrContainer[NATIVE], tProjectionNode, currentView);
							 | 
						
					
						
							
								
									
										
										
										
											2018-08-07 14:42:40 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    }
							 | 
						
					
						
							
								
									
										
										
										
											2018-04-09 17:35:50 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  }
							 | 
						
					
						
							
								
									
										
										
										
											2017-12-01 14:23:03 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 |