* 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, )
| 361 | * @param isClassBased `true` if `class` change (`false` if `style`) |
| 362 | */ |
| 363 | function stylingFirstUpdatePass( |
| 364 | tView: TView, |
| 365 | tStylingKey: TStylingKey, |
| 366 | bindingIndex: number, |
| 367 | isClassBased: boolean, |
| 368 | ): void { |
| 369 | ngDevMode && assertFirstUpdatePass(tView); |
| 370 | const tData = tView.data; |
| 371 | if (tData[bindingIndex + 1] === null) { |
| 372 | // The above check is necessary because we don't clear first update pass until first successful |
| 373 | // (no exception) template execution. This prevents the styling instruction from double adding |
| 374 | // itself to the list. |
| 375 | // `getSelectedIndex()` should be here (rather than in instruction) so that it is guarded by the |
| 376 | // if so as not to read unnecessarily. |
| 377 | const tNode = tData[getSelectedIndex()] as TNode; |
| 378 | ngDevMode && assertDefined(tNode, 'TNode expected'); |
| 379 | const isHostBindings = isInHostBindings(tView, bindingIndex); |
| 380 | if (hasStylingInputShadow(tNode, isClassBased) && tStylingKey === null && !isHostBindings) { |
| 381 | // `tStylingKey === null` implies that we are either `[style]` or `[class]` binding. |
| 382 | // If there is a directive which uses `@Input('style')` or `@Input('class')` than |
| 383 | // we need to neutralize this binding since that directive is shadowing it. |
| 384 | // We turn this into a noop by setting the key to `false` |
| 385 | tStylingKey = false; |
| 386 | } |
| 387 | tStylingKey = wrapInStaticStylingKey(tData, tNode, tStylingKey, isClassBased); |
| 388 | insertTStylingBinding(tData, tNode, tStylingKey, bindingIndex, isHostBindings, isClassBased); |
| 389 | } |
| 390 | } |
| 391 | |
| 392 | /** |
| 393 | * Adds static styling information to the binding if applicable. |
no test coverage detected