MCPcopy Index your code
hub / github.com/angular/angular / elementLikeStartShared

Function elementLikeStartShared

packages/core/src/render3/instructions/shared.ts:577–619  ·  view source on GitHub ↗
(
  tNode: TElementNode | TElementContainerNode,
  lView: LView,
  index: number,
  name: string,
  locateOrCreateNativeNode: (
    tView: TView,
    lView: LView,
    tNode: TNode,
    name: string,
    index: number,
  ) => RNode,
)

Source from the content-addressed store, hash-verified

575
576/** Shared code between instructions that indicate the start of an element. */
577export function elementLikeStartShared(
578 tNode: TElementNode | TElementContainerNode,
579 lView: LView,
580 index: number,
581 name: string,
582 locateOrCreateNativeNode: (
583 tView: TView,
584 lView: LView,
585 tNode: TNode,
586 name: string,
587 index: number,
588 ) => RNode,
589) {
590 const adjustedIndex = HEADER_OFFSET + index;
591 const tView = lView[TVIEW];
592 const native = locateOrCreateNativeNode(tView, lView, tNode, name, index);
593 lView[adjustedIndex] = native;
594 setCurrentTNode(tNode, true);
595
596 // It's important that this runs before we've instantiated the directives.
597 const isElement = tNode.type === TNodeType.Element;
598 if (isElement) {
599 setupStaticAttributes(lView[RENDERER], native as RElement, tNode);
600
601 // any immediate children of a component or template container must be pre-emptively
602 // monkey-patched with the component view data so that the element can be inspected
603 // later on using any element discovery utility methods (see `element_discovery.ts`)
604 if (getElementDepthCount() === 0 || isDirectiveHost(tNode)) {
605 attachPatchData(native, lView);
606 }
607 increaseElementDepthCount();
608 } else {
609 attachPatchData(native, lView);
610 }
611
612 if (wasLastNodeCreated() && (!isElement || !isDetachedByI18n(tNode))) {
613 // In the i18n case, the translation may have removed this element, so only add it if it is not
614 // detached. See `TNodeType.Placeholder` and `LFrame.inI18n` for more context.
615 appendChild(tView, lView, native, tNode);
616 }
617
618 return tNode;
619}
620
621/** Shared code between instructions that indicate the end of an element. */
622export function elementLikeEndShared(tNode: TNode): TNode {

Callers 4

initializeElementFunction · 0.90
ɵɵdomElementStartFunction · 0.90

Calls 9

setCurrentTNodeFunction · 0.90
setupStaticAttributesFunction · 0.90
getElementDepthCountFunction · 0.90
isDirectiveHostFunction · 0.90
attachPatchDataFunction · 0.90
wasLastNodeCreatedFunction · 0.90
isDetachedByI18nFunction · 0.90
appendChildFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…