-
Couldn't load subscription status.
- Fork 26.7k
Change static priority resolution to be same level as directive it belongs to #34938
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
2127b9f to
fb16cd7
Compare
fb16cd7 to
91a8cd6
Compare
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
91a8cd6 to
4cfe19d
Compare
42e1416 to
c4459fb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first round of comments from the first pass. I must say that I wasn't able to de-cipher all the details of the data structures used and the algorithm. I guess we should sync-up so you can walk me through it so I've got some more background.
At the same I didn't notice anything that would look "wrong", so we are for a good start here!
a6083ec to
03779b3
Compare
ff5e8ef to
60af7e0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good for merge, though we will do some additional cleanup (docs, any stylistic nits, etc) in a follow-up
…ctive it belongs to
This change changes the priority order of static styling.
Current priority:
```
(least priority)
- Static
- Component
- Directives
- Template
- Dynamic Binding
- Component
- Map/Interpolation
- Property
- Directives
- Map/Interpolation
- Property
- Template
- Map/Interpolation
- Property
(highest priority)
```
The issue with the above priority is this use case:
```
<div style="color: red;" directive-which-sets-color-blue>
```
In the above case the directive will win and the resulting color will be `blue`. However a small change of adding interpolation to the example like so. (Style interpolation is coming in angular#34202)
```
<div style="color: red; width: {{exp}}px" directive-which-sets-color-blue>
```
Changes the priority from static binding to interpolated binding which means now the resulting color is `red`. It is very surprising that adding an unrelated interpolation and style can change the `color` which was not changed. To fix that we need to make sure that the static values are associated with priority of the source (directive or template) where they were declared. The new resulting priority is:
```
(least priority)
- Component
- Static
- Map/Interpolation
- Property
- Directives
- Static
- Map/Interpolation
- Property
- Template
- Static
- Map/Interpolation
- Property
(highest priority)
```
…as directive it belongs to
…as directive it belongs to
…as directive it belongs to
…as directive it belongs to
…as directive it belongs to
2a169ef to
f115f53
Compare
…as directive it belongs to
f115f53 to
4039238
Compare
…ctive it belongs to (#34938) This change changes the priority order of static styling. Current priority: ``` (least priority) - Static - Component - Directives - Template - Dynamic Binding - Component - Map/Interpolation - Property - Directives - Map/Interpolation - Property - Template - Map/Interpolation - Property (highest priority) ``` The issue with the above priority is this use case: ``` <div style="color: red;" directive-which-sets-color-blue> ``` In the above case the directive will win and the resulting color will be `blue`. However a small change of adding interpolation to the example like so. (Style interpolation is coming in #34202) ``` <div style="color: red; width: {{exp}}px" directive-which-sets-color-blue> ``` Changes the priority from static binding to interpolated binding which means now the resulting color is `red`. It is very surprising that adding an unrelated interpolation and style can change the `color` which was not changed. To fix that we need to make sure that the static values are associated with priority of the source (directive or template) where they were declared. The new resulting priority is: ``` (least priority) - Component - Static - Map/Interpolation - Property - Directives - Static - Map/Interpolation - Property - Template - Static - Map/Interpolation - Property (highest priority) ``` PR Close #34938
…ctive it belongs to (#34938) This change changes the priority order of static styling. Current priority: ``` (least priority) - Static - Component - Directives - Template - Dynamic Binding - Component - Map/Interpolation - Property - Directives - Map/Interpolation - Property - Template - Map/Interpolation - Property (highest priority) ``` The issue with the above priority is this use case: ``` <div style="color: red;" directive-which-sets-color-blue> ``` In the above case the directive will win and the resulting color will be `blue`. However a small change of adding interpolation to the example like so. (Style interpolation is coming in #34202) ``` <div style="color: red; width: {{exp}}px" directive-which-sets-color-blue> ``` Changes the priority from static binding to interpolated binding which means now the resulting color is `red`. It is very surprising that adding an unrelated interpolation and style can change the `color` which was not changed. To fix that we need to make sure that the static values are associated with priority of the source (directive or template) where they were declared. The new resulting priority is: ``` (least priority) - Component - Static - Map/Interpolation - Property - Directives - Static - Map/Interpolation - Property - Template - Static - Map/Interpolation - Property (highest priority) ``` PR Close #34938
`TNode.directives` was introduced in angular#34938. Turns out that it is unnecessary because the information is already present it `TData` when combining with `TNode.directiveStart` and `TNode.directiveEnd` Mainly this is true (conceptually): ``` expect(tNode.directives).toEqual( tData.slice( tNode.directivesStart, tNode.directivesEnd - tNode.DirectivesStart -1 ) ); ``` The refactoring removes `TNode.directives` and adds `TNode.directiveStyling` as we still need to keep location in the directive in `TNode`
`TNode.directives` was introduced in #34938. Turns out that it is unnecessary because the information is already present it `TData` when combining with `TNode.directiveStart` and `TNode.directiveEnd` Mainly this is true (conceptually): ``` expect(tNode.directives).toEqual( tData.slice( tNode.directivesStart, tNode.directivesEnd - tNode.DirectivesStart -1 ) ); ``` The refactoring removes `TNode.directives` and adds `TNode.directiveStyling` as we still need to keep location in the directive in `TNode` PR Close #35050
`TNode.directives` was introduced in #34938. Turns out that it is unnecessary because the information is already present it `TData` when combining with `TNode.directiveStart` and `TNode.directiveEnd` Mainly this is true (conceptually): ``` expect(tNode.directives).toEqual( tData.slice( tNode.directivesStart, tNode.directivesEnd - tNode.DirectivesStart -1 ) ); ``` The refactoring removes `TNode.directives` and adds `TNode.directiveStyling` as we still need to keep location in the directive in `TNode` PR Close #35050
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This change changes the priority order of static styling.
Current priority:
The issue with the above priority is this use case:
In the above case the directive will win and the resulting color will be
blue. However a small change of adding interpolation to the example like so. (Style interpolation is coming in #34202)Changes the priority from static binding to interpolated binding which means now the resulting color is
red. It is very surprising that adding an unrelated interpolation and style can change thecolorwhich was not changed. To fix that we need to make sure that the static values are associated with priority of the source (directive or template) where they were declared. The new resulting priority is:PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information