refactor(ivy): renames and documentation updates (#27925)

PR Close #27925
This commit is contained in:
Pawel Kozlowski
2019-01-04 11:58:51 +01:00
committed by Kara Erickson
parent e94e7eef4c
commit 3ac249b2ab

View File

@ -6,7 +6,6 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
import {assertDefined} from './assert';
import {attachPatchData} from './context_discovery'; import {attachPatchData} from './context_discovery';
import {callHooks} from './hooks'; import {callHooks} from './hooks';
import {LContainer, NATIVE, RENDER_PARENT, VIEWS, unusedValueExportToPlacateAjd as unused1} from './interfaces/container'; import {LContainer, NATIVE, RENDER_PARENT, VIEWS, unusedValueExportToPlacateAjd as unused1} from './interfaces/container';
@ -19,12 +18,12 @@ import {findComponentView, getNativeByTNode, isLContainer, isRootView, readEleme
const unusedValueToPlacateAjd = unused1 + unused2 + unused3 + unused4 + unused5; const unusedValueToPlacateAjd = unused1 + unused2 + unused3 + unused4 + unused5;
/** Retrieves the parent element of a given node. */ /** Retrieves the native node (element or a comment) for the parent of a given node. */
export function getParentNative(tNode: TNode, currentView: LView): RElement|RComment|null { export function getParentNative(tNode: TNode, currentView: LView): RElement|RComment|null {
if (tNode.parent == null) { if (tNode.parent == null) {
return getHostNative(currentView); return getHostNative(currentView);
} else { } else {
const parentTNode = getFirstParentNative(tNode); const parentTNode = getFirstNonICUParent(tNode);
return getNativeByTNode(parentTNode, currentView); return getNativeByTNode(parentTNode, currentView);
} }
} }
@ -32,7 +31,7 @@ export function getParentNative(tNode: TNode, currentView: LView): RElement|RCom
/** /**
* Get the first parent of a node that isn't an IcuContainer TNode * Get the first parent of a node that isn't an IcuContainer TNode
*/ */
function getFirstParentNative(tNode: TNode): TNode { function getFirstNonICUParent(tNode: TNode): TNode {
let parent = tNode.parent; let parent = tNode.parent;
while (parent && parent.type === TNodeType.IcuContainer) { while (parent && parent.type === TNodeType.IcuContainer) {
parent = parent.parent; parent = parent.parent;
@ -606,7 +605,7 @@ export function canInsertNativeNode(tNode: TNode, currentView: LView): boolean {
currentNode = getHighestElementContainer(tNode); currentNode = getHighestElementContainer(tNode);
parent = currentNode.parent; parent = currentNode.parent;
} else if (tNode.parent.type === TNodeType.IcuContainer) { } else if (tNode.parent.type === TNodeType.IcuContainer) {
currentNode = getFirstParentNative(currentNode); currentNode = getFirstNonICUParent(currentNode);
parent = currentNode.parent; parent = currentNode.parent;
} }
} }