* 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, )
| 845 | * @param bindingIndex Binding index of the binding. |
| 846 | */ |
| 847 | function updateStyling( |
| 848 | tView: TView, |
| 849 | tNode: TNode, |
| 850 | lView: LView, |
| 851 | renderer: Renderer, |
| 852 | prop: string, |
| 853 | value: string | undefined | null | boolean, |
| 854 | isClassBased: boolean, |
| 855 | bindingIndex: number, |
| 856 | ) { |
| 857 | if (!(tNode.type & TNodeType.AnyRNode)) { |
| 858 | // It is possible to have styling on non-elements (such as ng-container). |
| 859 | // This is rare, but it does happen. In such a case, just ignore the binding. |
| 860 | return; |
| 861 | } |
| 862 | const tData = tView.data; |
| 863 | const tRange = tData[bindingIndex + 1] as TStylingRange; |
| 864 | const higherPriorityValue = getTStylingRangeNextDuplicate(tRange) |
| 865 | ? findStylingValue(tData, tNode, lView, prop, getTStylingRangeNext(tRange), isClassBased) |
| 866 | : undefined; |
| 867 | if (!isStylingValuePresent(higherPriorityValue)) { |
| 868 | // We don't have a next duplicate, or we did not find a duplicate value. |
| 869 | if (!isStylingValuePresent(value)) { |
| 870 | // We should delete current value or restore to lower priority value. |
| 871 | if (getTStylingRangePrevDuplicate(tRange)) { |
| 872 | // We have a possible prev duplicate, let's retrieve it. |
| 873 | value = findStylingValue(tData, null, lView, prop, bindingIndex, isClassBased); |
| 874 | } |
| 875 | } |
| 876 | const rNode = getNativeByIndex(getSelectedIndex(), lView) as RElement; |
| 877 | applyStyling(renderer, isClassBased, rNode, prop, value); |
| 878 | } |
| 879 | } |
| 880 | |
| 881 | /** |
| 882 | * Search for styling value with higher priority which is overwriting current value, or a |
no test coverage detected
searching dependent graphs…