* Update a simple (property name) styling. * * This function takes `prop` and updates the DOM to that value. The function takes the binding * value as well as binding priority into consideration to determine which value should be written * to DOM. (For example it may be determined that there is
( tView: TView, tNode: TNode, lView: LView, renderer: Renderer, prop: string, value: string | undefined | null | boolean, isClassBased: boolean, bindingIndex: number, )
| 882 | * @param bindingIndex Binding index of the binding. |
| 883 | */ |
| 884 | function updateStyling( |
| 885 | tView: TView, |
| 886 | tNode: TNode, |
| 887 | lView: LView, |
| 888 | renderer: Renderer, |
| 889 | prop: string, |
| 890 | value: string | undefined | null | boolean, |
| 891 | isClassBased: boolean, |
| 892 | bindingIndex: number, |
| 893 | ) { |
| 894 | if (!(tNode.type & TNodeType.AnyRNode)) { |
| 895 | // It is possible to have styling on non-elements (such as ng-container). |
| 896 | // This is rare, but it does happen. In such a case, just ignore the binding. |
| 897 | return; |
| 898 | } |
| 899 | const tData = tView.data; |
| 900 | const tRange = tData[bindingIndex + 1] as TStylingRange; |
| 901 | const higherPriorityValue = getTStylingRangeNextDuplicate(tRange) |
| 902 | ? findStylingValue(tData, tNode, lView, prop, getTStylingRangeNext(tRange), isClassBased) |
| 903 | : undefined; |
| 904 | if (!isStylingValuePresent(higherPriorityValue)) { |
| 905 | // We don't have a next duplicate, or we did not find a duplicate value. |
| 906 | if (!isStylingValuePresent(value)) { |
| 907 | // We should delete current value or restore to lower priority value. |
| 908 | if (getTStylingRangePrevDuplicate(tRange)) { |
| 909 | // We have a possible prev duplicate, let's retrieve it. |
| 910 | value = findStylingValue(tData, null, lView, prop, bindingIndex, isClassBased); |
| 911 | } |
| 912 | } |
| 913 | const rNode = getNativeByIndex(getSelectedIndex(), lView) as RElement; |
| 914 | applyStyling(renderer, isClassBased, rNode, prop, value); |
| 915 | } |
| 916 | } |
| 917 | |
| 918 | /** |
| 919 | * Search for styling value with higher priority which is overwriting current value, or a |
no test coverage detected