Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(compiler): Not all attribute values beginning with a colon a…
…re namespaced (#53574) TemplateDefinitionBuilder is apparently more careful about when it attempts to split namespaces in attribute values. However, we are doing this on style attributes, which might start with a single `:`. Rather than refactor our logic to only try to split namespaces in some cases, we can just add an option to make namespace splitting fail gracefully. We only use this option for attributes, not elements. Note also: the compiled code for this, while "correct" is absolutely insane. Maybe we should consider fixing this, as a matter of principle. PR Close #53574
- Loading branch information
1 parent
7ef5d9d
commit c987945
Showing
6 changed files
with
67 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...ler-cli/test/compliance/test_cases/r3_view_compiler_styling/style_bindings/colon_style.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// NOTE: This is the way TemplateDefinitionBuilder behaves today, but it's crazy!! | ||
// NOTE: TODO: Should we fix it? | ||
consts: [[__AttributeMarker.Styles__, ":root {color", "red"]], | ||
template: function MyComponent_Template(rf, ctx) { | ||
if (rf & 1) { | ||
i0.ɵɵelement(0, "div", 0); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...ler-cli/test/compliance/test_cases/r3_view_compiler_styling/style_bindings/colon_style.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import {Component} from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'my-component', | ||
standalone: true, | ||
template: ` | ||
<div style=":root {color: red;}"></div> | ||
` | ||
}) | ||
export class MyComponent { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters