* 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, )
| 322 | * @param isClassBased `true` if `class` change (`false` if `style`) |
| 323 | */ |
| 324 | function 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. |
no test coverage detected
searching dependent graphs…