refactor(ivy): move classMap interpolation logic internally (#31211)

Adds the new `classMapInterpolate1` through `classMapInterpolate8` instructions which handle interpolations inside the `class` attribute and moves the interpolation logic internally. This allows us to remove the `interpolationX` instructions in a follow-up PR.

These changes also add an error if an interpolation is encountered inside a `style` tag (e.g. `style="width: {{value}}"`). Up until now this would actually generate valid instructions, because `styleMap` goes through the same code path as `classMap` which does support interpolation. At runtime, however, `styleMap` would set invalid styles that look like `<div style="0:w;1:i;2:d;3:t;4:h;5::;7:1;">`. In `ViewEngine` interpolations inside `style` weren't supported either, however there we'd output invalid styles like `<div style="unsafe">`, even if the content was trusted.

PR Close #31211
This commit is contained in:
crisbeto
2019-06-27 18:57:09 +02:00
committed by Alex Rickabaugh
parent dca713c087
commit 02491a6ce8
15 changed files with 1469 additions and 89 deletions

View File

@ -36,6 +36,16 @@ export {
ɵɵattributeInterpolateV,
ɵɵclassMap,
ɵɵclassMapInterpolate1,
ɵɵclassMapInterpolate2,
ɵɵclassMapInterpolate3,
ɵɵclassMapInterpolate4,
ɵɵclassMapInterpolate5,
ɵɵclassMapInterpolate6,
ɵɵclassMapInterpolate7,
ɵɵclassMapInterpolate8,
ɵɵclassMapInterpolateV,
ɵɵclassProp,
ɵɵcomponentHostSyntheticListener,
@ -97,7 +107,18 @@ export {
ɵɵselect,
ɵɵstyleMap,
ɵɵstyleProp,
ɵɵstylePropInterpolate1,
ɵɵstylePropInterpolate2,
ɵɵstylePropInterpolate3,
ɵɵstylePropInterpolate4,
ɵɵstylePropInterpolate5,
ɵɵstylePropInterpolate6,
ɵɵstylePropInterpolate7,
ɵɵstylePropInterpolate8,
ɵɵstylePropInterpolateV,
ɵɵstyleSanitizer,
ɵɵstyling,
ɵɵstylingApply,