Repository navigation
Commit 84a398b
fix(core): improve the warning for bindings on elements inside ICU expressions
Directives and bindings are not supported on elements inside ICU
expressions, because ICU content is processed at runtime as plain HTML.
Using one anyway, e.g. `<b [title]="title">` inside a plural case, used to
crash with a cryptic `InvalidCharacterError` from `setAttribute`. Since the
ICU attribute allowlist was introduced, such attributes are dropped with a
generic "ignoring unknown attribute name" warning that points to the XSS
security guide, which doesn't tell developers what is actually wrong.
Detect binding-like attribute names (`[prop]`, `(event)`, `*structural`,
`#ref`, `@trigger`) while parsing ICU content and report them in
development mode with a dedicated `NG0700` warning that names the attribute
and the element and explains that only static attributes are allowed
inside ICU cases. The attribute is still ignored, as before.
Fixes #37298
(cherry picked from commit 8523b79)1 parent 566e9b6 commit 84a398b
2 files changed
Lines changed: 58 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
814 | 815 | | |
815 | 816 | | |
816 | 817 | | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
817 | 833 | | |
818 | 834 | | |
819 | 835 | | |
| |||
1010 | 1026 | | |
1011 | 1027 | | |
1012 | 1028 | | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3603 | 3603 | | |
3604 | 3604 | | |
3605 | 3605 | | |
| 3606 | + | |
| 3607 | + | |
| 3608 | + | |
| 3609 | + | |
| 3610 | + | |
| 3611 | + | |
| 3612 | + | |
| 3613 | + | |
| 3614 | + | |
| 3615 | + | |
| 3616 | + | |
| 3617 | + | |
| 3618 | + | |
| 3619 | + | |
| 3620 | + | |
| 3621 | + | |
| 3622 | + | |
| 3623 | + | |
| 3624 | + | |
| 3625 | + | |
| 3626 | + | |
| 3627 | + | |
| 3628 | + | |
| 3629 | + | |
| 3630 | + | |
| 3631 | + | |
| 3632 | + | |
| 3633 | + | |
3606 | 3634 | | |
3607 | 3635 | | |
3608 | 3636 | | |
| |||
0 commit comments