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

Function collectResidual

packages/core/src/render3/instructions/styling.ts:551–571  ·  view source on GitHub ↗

* Collect all static values after the current `TNode.directiveStylingLast` index. * * Collect the remaining styling information which has not yet been collected by an existing * styling instruction. * * @param tData `TData` where the `DirectiveDefs` are stored. * @param tNode `TNode` which con

(
  tData: TData,
  tNode: TNode,
  isClassBased: boolean,
)

Source from the content-addressed store, hash-verified

549 * @param isClassBased `true` if `class` (`false` if `style`)
550 */
551function collectResidual(
552 tData: TData,
553 tNode: TNode,
554 isClassBased: boolean,
555): KeyValueArray<any> | null {
556 let residual: KeyValueArray<any> | null | undefined = undefined;
557 const directiveEnd = tNode.directiveEnd;
558 ngDevMode &&
559 assertNotEqual(
560 tNode.directiveStylingLast,
561 -1,
562 'By the time this function gets called at least one hostBindings-node styling instruction must have executed.',
563 );
564 // We add `1 + tNode.directiveStart` because we need to skip the current directive (as we are
565 // collecting things after the last `hostBindings` directive which had a styling instruction.)
566 for (let i = 1 + tNode.directiveStylingLast; i < directiveEnd; i++) {
567 const attrs = (tData[i] as DirectiveDef<any>).hostAttrs;
568 residual = collectStylingFromTAttrs(residual, attrs, isClassBased) as KeyValueArray<any> | null;
569 }
570 return collectStylingFromTAttrs(residual, tNode.attrs, isClassBased) as KeyValueArray<any> | null;
571}
572
573/**
574 * Collect the static styling information with lower priority than `hostDirectiveDef`.

Callers 1

wrapInStaticStylingKeyFunction · 0.85

Calls 2

assertNotEqualFunction · 0.90
collectStylingFromTAttrsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…