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

Function stylingFirstUpdatePass

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

* Collects the necessary information to insert the binding into a linked list of style bindings * using `insertTStylingBinding`. * * @param tView `TView` where the binding linked list will be stored. * @param tStylingKey Property/key of the binding. * @param bindingIndex Index of binding associ

(
  tView: TView,
  tStylingKey: TStylingKey,
  bindingIndex: number,
  isClassBased: boolean,
)

Source from the content-addressed store, hash-verified

322 * @param isClassBased `true` if `class` change (`false` if `style`)
323 */
324function stylingFirstUpdatePass(
325 tView: TView,
326 tStylingKey: TStylingKey,
327 bindingIndex: number,
328 isClassBased: boolean,
329): void {
330 ngDevMode && assertFirstUpdatePass(tView);
331 const tData = tView.data;
332 if (tData[bindingIndex + 1] === null) {
333 // The above check is necessary because we don't clear first update pass until first successful
334 // (no exception) template execution. This prevents the styling instruction from double adding
335 // itself to the list.
336 // `getSelectedIndex()` should be here (rather than in instruction) so that it is guarded by the
337 // if so as not to read unnecessarily.
338 const tNode = tData[getSelectedIndex()] as TNode;
339 ngDevMode && assertDefined(tNode, 'TNode expected');
340 const isHostBindings = isInHostBindings(tView, bindingIndex);
341 if (hasStylingInputShadow(tNode, isClassBased) && tStylingKey === null && !isHostBindings) {
342 // `tStylingKey === null` implies that we are either `[style]` or `[class]` binding.
343 // If there is a directive which uses `@Input('style')` or `@Input('class')` than
344 // we need to neutralize this binding since that directive is shadowing it.
345 // We turn this into a noop by setting the key to `false`
346 tStylingKey = false;
347 }
348 tStylingKey = wrapInStaticStylingKey(tData, tNode, tStylingKey, isClassBased);
349 insertTStylingBinding(tData, tNode, tStylingKey, bindingIndex, isHostBindings, isClassBased);
350 }
351}
352
353/**
354 * Adds static styling information to the binding if applicable.

Callers 2

checkStylingPropertyFunction · 0.85
checkStylingMapFunction · 0.85

Calls 7

assertFirstUpdatePassFunction · 0.90
getSelectedIndexFunction · 0.90
assertDefinedFunction · 0.90
insertTStylingBindingFunction · 0.90
isInHostBindingsFunction · 0.85
hasStylingInputShadowFunction · 0.85
wrapInStaticStylingKeyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…