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

Function createTNode

packages/core/src/render3/tnode_manipulation.ts:272–343  ·  view source on GitHub ↗
(
  tView: TView,
  tParent: TElementNode | TContainerNode | null,
  type: TNodeType,
  index: number,
  value: string | null,
  attrs: TAttributes | null,
)

Source from the content-addressed store, hash-verified

270 attrs: TAttributes | null,
271): TNode;
272export function createTNode(
273 tView: TView,
274 tParent: TElementNode | TContainerNode | null,
275 type: TNodeType,
276 index: number,
277 value: string | null,
278 attrs: TAttributes | null,
279): TNode {
280 ngDevMode &&
281 index !== 0 && // 0 are bogus nodes and they are OK. See `createContainerRef` in
282 // `view_engine_compatibility` for additional context.
283 assertGreaterThanOrEqual(index, HEADER_OFFSET, "TNodes can't be in the LView header.");
284 ngDevMode && assertNotSame(attrs, undefined, "'undefined' is not valid value for 'attrs'");
285 ngDevMode && tParent && assertTNodeForTView(tParent, tView);
286 let injectorIndex = tParent ? tParent.injectorIndex : -1;
287 let flags = 0;
288 if (isInSkipHydrationBlock()) {
289 flags |= TNodeFlags.inSkipHydrationBlock;
290 }
291
292 // TODO: would it be helpful to use a prototypal inheritance here, similar to the way we do so with signals?
293 const tNode = {
294 type,
295 index,
296 insertBeforeIndex: null,
297 injectorIndex,
298 directiveStart: -1,
299 directiveEnd: -1,
300 directiveStylingLast: -1,
301 componentOffset: -1,
302 controlDirectiveIndex: -1,
303 customControlIndex: -1,
304 propertyBindings: null,
305 flags,
306 providerIndexes: 0,
307 value: value,
308 namespace: getNamespace(),
309 attrs: attrs,
310 mergedAttrs: null,
311 localNames: null,
312 initialInputs: null,
313 inputs: null,
314 hostDirectiveInputs: null,
315 outputs: null,
316 hostDirectiveOutputs: null,
317 directiveToIndex: null,
318 tView: null,
319 next: null,
320 prev: null,
321 projectionNext: null,
322 child: null,
323 parent: tParent,
324 projection: null,
325 styles: null,
326 stylesWithoutHost: null,
327 residualStyles: undefined,
328 classes: null,
329 classesWithoutHost: null,

Callers 10

view_utils_spec.tsFile · 0.90
constructorMethod · 0.90
testLStaticDataFunction · 0.90
isMatchingFunction · 0.90
matchers_spec.tsFile · 0.90
tNodeFunction · 0.90
enterViewWithOneDivFunction · 0.90
createTNodeAtIndexFunction · 0.85

Calls 5

assertGreaterThanOrEqualFunction · 0.90
assertNotSameFunction · 0.90
assertTNodeForTViewFunction · 0.90
isInSkipHydrationBlockFunction · 0.90
getNamespaceFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…