fix(ivy): ngClass not applying classes with trailing/leading spaces (#34539)
Fixes classes with trailing or leading space that are passed to `ngClass` (e.g. `{'foo ': bar}`) not being applied in Ivy. The issue comes from the fact that when the styling differ builds up the style map it uses the trimmed key to look up the value in the map that uses non-trimmed keys. Fixes #34476. PR Close #34539
This commit is contained in:

committed by
Alex Rickabaugh

parent
6fda7f3da4
commit
d909fb0b1f
@ -212,11 +212,11 @@ function bulidMapFromValues(
|
||||
// case 1: map
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
let key = keys[i];
|
||||
key = trim ? key.trim() : key;
|
||||
const value = (values as{[key: string]: any})[key];
|
||||
|
||||
if (value !== undefined) {
|
||||
setMapValues(map, key, value, parseOutUnits, allowSubKeys);
|
||||
// Map uses untrimmed keys, so don't trim until passing to `setMapValues`
|
||||
setMapValues(map, trim ? key.trim() : key, value, parseOutUnits, allowSubKeys);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user