Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(ivy): remove the getHostNative utility function #33554

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 3 additions & 14 deletions packages/core/src/render3/node_manipulation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {ProceduralRenderer3, RElement, RNode, RText, Renderer3, isProceduralRend
import {isLContainer, isLView, isRootView} from './interfaces/type_checks';
import {CHILD_HEAD, CLEANUP, DECLARATION_LCONTAINER, FLAGS, HOST, HookData, LView, LViewFlags, NEXT, PARENT, QUERIES, RENDERER, TVIEW, T_HOST, unusedValueExportToPlacateAjd as unused5} from './interfaces/view';
import {assertNodeOfPossibleTypes, assertNodeType} from './node_assert';
import {findComponentView, getLViewParent} from './util/view_traversal_utils';
import {findComponentView} from './util/view_traversal_utils';
import {getNativeByTNode, getNativeByTNodeOrNull, unwrapRNode} from './util/view_utils';

const unusedValueToPlacateAjd = unused1 + unused2 + unused3 + unused4 + unused5;
Expand Down Expand Up @@ -515,7 +515,8 @@ function getRenderParent(tNode: TNode, currentView: LView): RElement|null {
} else {
// We are inserting a root element of the component view into the component host element and
// it should always be eager.
return getHostNative(currentView);
ngDevMode && assertNodeOfPossibleTypes(hostTNode, TNodeType.Element);
return currentView[HOST];
}
} else {
const isIcuCase = tNode && tNode.type === TNodeType.IcuContainer;
Expand Down Expand Up @@ -547,18 +548,6 @@ function getRenderParent(tNode: TNode, currentView: LView): RElement|null {
}
}

/**
* 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 {
ngDevMode && assertLView(currentView);
const hostTNode = currentView[T_HOST];
return hostTNode && hostTNode.type === TNodeType.Element ?
(getNativeByTNode(hostTNode, getLViewParent(currentView) !) as RElement) :
null;
}

/**
* 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,6 @@
{
"name": "getFactoryDef"
},
{
"name": "getHostNative"
},
{
"name": "getInitialStylingValue"
},
Expand All @@ -326,9 +323,6 @@
{
"name": "getLView"
},
{
"name": "getLViewParent"
},
{
"name": "getMapProp"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,6 @@
{
"name": "getFactoryDef"
},
{
"name": "getHostNative"
},
{
"name": "getInjectorIndex"
},
Expand All @@ -260,9 +257,6 @@
{
"name": "getLView"
},
{
"name": "getLViewParent"
},
{
"name": "getNativeAnchorNode"
},
Expand Down
3 changes: 0 additions & 3 deletions packages/core/test/bundling/todo/bundle.golden_symbols.json
Original file line number Diff line number Diff line change
Expand Up @@ -674,9 +674,6 @@
{
"name": "getGuardMask"
},
{
"name": "getHostNative"
},
{
"name": "getInitialStylingValue"
},
Expand Down