fix(ivy): handle SafeStyles in [style.prop] correctly (#34286)

Prior to this commit, values wrapped into SafeStyle were not handled correctly in [style.prop] bindings in case style sanitizer is present (when template contains some style props that require sanitization). Style sanitizer was not unwrapping values in case a given prop doesn't require sanitization.As a result, wrapped values were used as final styling values (see https://github.com/angular/angular/blob/master/packages/core/src/render3/styling/bindings.ts#L620). This commit updates the logic to unwrap safe values in sanitizer in case no sanitization is required.

PR Close #34286
This commit is contained in:
Andrew Kushnir
2019-12-06 14:24:09 -08:00
parent 7c2bb37e4e
commit b0d5784b63
2 changed files with 60 additions and 1 deletions

View File

@ -196,7 +196,7 @@ export const ɵɵdefaultStyleSanitizer =
}
if (mode & StyleSanitizeMode.SanitizeOnly) {
return doSanitizeValue ? ɵɵsanitizeStyle(value) : value;
return doSanitizeValue ? ɵɵsanitizeStyle(value) : unwrapSafeValue(value);
} else {
return doSanitizeValue;
}