Commit 8d4dd45
fix($compile): don't trim white-space in attributes
BREAKING CHANGE:
White-space in attributes is no longer trimmed automatically. This includes leading and trailing
whitespace, and attributes that are purely white-space.
This allows developers to use white-space in their attributes, for example as value for
input[type=radio], as a separator in ngList, or as a value in any custom directive binding.
To migrate, attributes that require trimming must now be trimmed manually.
A common cases where stray white-space can cause problems is when
attribute values are compared, for example in an $observer:
```
$attrs.$observe('myAttr', function(newVal) {
if (newVal === 'false') ...
});
```
Note that `$parse` trims expressions automatically, so attributes with expressions (e.g. directive
bindings) are unlikely to be affected by stray white-space.
Fixes angular#5513
Fixes angular#14539
Closes angular#5597
ngList test1 parent f3377da commit 8d4dd45
File tree
3 files changed
+15
-1
lines changed- src/ng
- test/ng
- directive
3 files changed
+15
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1893 | 1893 | | |
1894 | 1894 | | |
1895 | 1895 | | |
1896 | | - | |
| 1896 | + | |
1897 | 1897 | | |
1898 | 1898 | | |
1899 | 1899 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4702 | 4702 | | |
4703 | 4703 | | |
4704 | 4704 | | |
| 4705 | + | |
| 4706 | + | |
| 4707 | + | |
| 4708 | + | |
| 4709 | + | |
| 4710 | + | |
| 4711 | + | |
| 4712 | + | |
4705 | 4713 | | |
4706 | 4714 | | |
4707 | 4715 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
133 | 139 | | |
134 | 140 | | |
135 | 141 | | |
0 commit comments