MCPcopy Create free account
hub / github.com/angular/angular / checkStylingProperty

Function checkStylingProperty

packages/core/src/render3/instructions/styling.ts:209–240  ·  view source on GitHub ↗
(
  prop: string,
  value: any | NO_CHANGE,
  suffix: string | undefined | null,
  isClassBased: boolean,
)

Source from the content-addressed store, hash-verified

207 * @param isClassBased `true` if `class` change (`false` if `style`)
208 */
209export function checkStylingProperty(
210 prop: string,
211 value: any | NO_CHANGE,
212 suffix: string | undefined | null,
213 isClassBased: boolean,
214): void {
215 const lView = getLView();
216 const tView = getTView();
217 // Styling instructions use 2 slots per binding.
218 // 1. one for the value / TStylingKey
219 // 2. one for the intermittent-value / TStylingRange
220 const bindingIndex = incrementBindingIndex(2);
221 if (tView.firstUpdatePass) {
222 stylingFirstUpdatePass(tView, prop, bindingIndex, isClassBased);
223 }
224 if (value !== NO_CHANGE && bindingUpdated(lView, bindingIndex, value)) {
225 if (ngDevMode && !isClassBased) {
226 warnInvalidStylePropValue(prop, value);
227 }
228 const tNode = tView.data[getSelectedIndex()] as TNode;
229 updateStyling(
230 tView,
231 tNode,
232 lView,
233 lView[RENDERER],
234 prop,
235 (lView[bindingIndex + 1] = normalizeSuffix(value, suffix)),
236 isClassBased,
237 bindingIndex,
238 );
239 }
240}
241
242function warnInvalidStylePropValue(prop: string, value: unknown): void {
243 if (

Callers 2

ɵɵstylePropFunction · 0.85
ɵɵclassPropFunction · 0.85

Calls 9

getLViewFunction · 0.90
getTViewFunction · 0.90
incrementBindingIndexFunction · 0.90
bindingUpdatedFunction · 0.90
getSelectedIndexFunction · 0.90
stylingFirstUpdatePassFunction · 0.85
updateStylingFunction · 0.85
normalizeSuffixFunction · 0.85

Tested by

no test coverage detected