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

@ -72,8 +72,46 @@ export class Identifiers {
static classMap: o.ExternalReference = {name: 'ɵɵclassMap', moduleName: CORE};
static classMapInterpolate1:
o.ExternalReference = {name: 'ɵɵclassMapInterpolate1', moduleName: CORE};
static classMapInterpolate2:
o.ExternalReference = {name: 'ɵɵclassMapInterpolate2', moduleName: CORE};
static classMapInterpolate3:
o.ExternalReference = {name: 'ɵɵclassMapInterpolate3', moduleName: CORE};
static classMapInterpolate4:
o.ExternalReference = {name: 'ɵɵclassMapInterpolate4', moduleName: CORE};
static classMapInterpolate5:
o.ExternalReference = {name: 'ɵɵclassMapInterpolate5', moduleName: CORE};
static classMapInterpolate6:
o.ExternalReference = {name: 'ɵɵclassMapInterpolate6', moduleName: CORE};
static classMapInterpolate7:
o.ExternalReference = {name: 'ɵɵclassMapInterpolate7', moduleName: CORE};
static classMapInterpolate8:
o.ExternalReference = {name: 'ɵɵclassMapInterpolate8', moduleName: CORE};
static classMapInterpolateV:
o.ExternalReference = {name: 'ɵɵclassMapInterpolateV', moduleName: CORE};
static styleProp: o.ExternalReference = {name: 'ɵɵstyleProp', moduleName: CORE};
static stylePropInterpolate1:
o.ExternalReference = {name: 'ɵɵstylePropInterpolate1', moduleName: CORE};
static stylePropInterpolate2:
o.ExternalReference = {name: 'ɵɵstylePropInterpolate2', moduleName: CORE};
static stylePropInterpolate3:
o.ExternalReference = {name: 'ɵɵstylePropInterpolate3', moduleName: CORE};
static stylePropInterpolate4:
o.ExternalReference = {name: 'ɵɵstylePropInterpolate4', moduleName: CORE};
static stylePropInterpolate5:
o.ExternalReference = {name: 'ɵɵstylePropInterpolate5', moduleName: CORE};
static stylePropInterpolate6:
o.ExternalReference = {name: 'ɵɵstylePropInterpolate6', moduleName: CORE};
static stylePropInterpolate7:
o.ExternalReference = {name: 'ɵɵstylePropInterpolate7', moduleName: CORE};
static stylePropInterpolate8:
o.ExternalReference = {name: 'ɵɵstylePropInterpolate8', moduleName: CORE};
static stylePropInterpolateV:
o.ExternalReference = {name: 'ɵɵstylePropInterpolateV', moduleName: CORE};
static stylingApply: o.ExternalReference = {name: 'ɵɵstylingApply', moduleName: CORE};
static styleSanitizer: o.ExternalReference = {name: 'ɵɵstyleSanitizer', moduleName: CORE};