diff --git a/packages/core/src/render3/instructions/styling.ts b/packages/core/src/render3/instructions/styling.ts index 0fe940e6ca..c8d9e0ed67 100644 --- a/packages/core/src/render3/instructions/styling.ts +++ b/packages/core/src/render3/instructions/styling.ts @@ -119,9 +119,7 @@ export function ɵɵclassProp( * * @codeGenApi */ -export function ɵɵstyleMap( - styles: {[styleName: string]: any} | Map| string | - undefined | null): void { +export function ɵɵstyleMap(styles: {[styleName: string]: any} | string | undefined | null): void { checkStylingMap(styleKeyValueArraySet, styleStringParser, styles, false); } @@ -161,8 +159,7 @@ export function styleStringParser(keyValueArray: KeyValueArray, text: strin * @codeGenApi */ export function ɵɵclassMap( - classes: {[className: string]: boolean | undefined | null} | - Map| Set| string[] | string | undefined | null): void { + classes: {[className: string]: boolean | undefined | null} | string | undefined | null): void { checkStylingMap(keyValueArraySet, classStringParser, classes, true); } @@ -626,8 +623,8 @@ export function getHostDirectiveDef(tData: TData): DirectiveDef|null { */ export function toStylingKeyValueArray( keyValueArraySet: (keyValueArray: KeyValueArray, key: string, value: any) => void, - stringParser: (styleKeyValueArray: KeyValueArray, text: string) => void, value: string| - string[]|{[key: string]: any}|Map|Set|null|undefined): KeyValueArray { + stringParser: (styleKeyValueArray: KeyValueArray, text: string) => void, + value: string|string[]|{[key: string]: any}|null|undefined): KeyValueArray { if (value == null /*|| value === undefined */ || value === '') return EMPTY_ARRAY as any; const styleKeyValueArray: KeyValueArray = [] as any; if (Array.isArray(value)) { @@ -635,15 +632,9 @@ export function toStylingKeyValueArray( keyValueArraySet(styleKeyValueArray, value[i], true); } } else if (typeof value === 'object') { - if (value instanceof Map) { - value.forEach((v, k) => keyValueArraySet(styleKeyValueArray, k, v)); - } else if (value instanceof Set) { - value.forEach((k) => keyValueArraySet(styleKeyValueArray, k, true)); - } else { - for (const key in value) { - if (value.hasOwnProperty(key)) { - keyValueArraySet(styleKeyValueArray, key, value[key]); - } + for (const key in value) { + if (value.hasOwnProperty(key)) { + keyValueArraySet(styleKeyValueArray, key, value[key]); } } } else if (typeof value === 'string') { @@ -674,11 +665,10 @@ function styleKeyValueArraySet(keyValueArray: KeyValueArray, key: string, v * Update map based styling. * * Map based styling could be anything which contains more than one binding. For example `string`, - * `Map`, `Set` or object literal. Dealing with all of these types would complicate the logic so + * or object literal. Dealing with all of these types would complicate the logic so * instead this function expects that the complex input is first converted into normalized * `KeyValueArray`. The advantage of normalization is that we get the values sorted, which makes it - * very - * cheap to compute deltas between the previous and current value. + * very cheap to compute deltas between the previous and current value. * * @param tView Associated `TView.data` contains the linked list of binding priorities. * @param tNode `TNode` where the binding is located. diff --git a/packages/core/test/render3/instructions/styling_spec.ts b/packages/core/test/render3/instructions/styling_spec.ts index bc71737c69..22a09c4e68 100644 --- a/packages/core/test/render3/instructions/styling_spec.ts +++ b/packages/core/test/render3/instructions/styling_spec.ts @@ -440,19 +440,6 @@ describe('styling', () => { ] as any); }); }); - describe('Map', () => { - it('should parse', () => { - expect(toStylingKeyValueArray( - keyValueArraySet, null !, new Map([['X', 'x'], ['A', 'a']]))) - .toEqual(['A', 'a', 'X', 'x'] as any); - }); - }); - describe('Iterable', () => { - it('should parse', () => { - expect(toStylingKeyValueArray(keyValueArraySet, null !, new Set(['X', 'A']))) - .toEqual(['A', true, 'X', true] as any); - }); - }); }); }); diff --git a/tools/public_api_guard/core/core.d.ts b/tools/public_api_guard/core/core.d.ts index 1b3220ba04..9e60f3f254 100644 --- a/tools/public_api_guard/core/core.d.ts +++ b/tools/public_api_guard/core/core.d.ts @@ -704,7 +704,7 @@ export declare function ɵɵattributeInterpolateV(attrName: string, values: any[ export declare function ɵɵclassMap(classes: { [className: string]: boolean | undefined | null; -} | Map | Set | string[] | string | undefined | null): void; +} | string | undefined | null): void; export declare function ɵɵclassMapInterpolate1(prefix: string, v0: any, suffix: string): void; @@ -1035,7 +1035,7 @@ export declare function ɵɵstaticViewQuery(predicate: Type | string[], export declare function ɵɵstyleMap(styles: { [styleName: string]: any; -} | Map | string | undefined | null): void; +} | string | undefined | null): void; export declare function ɵɵstyleProp(prop: string, value: string | number | SafeValue | undefined | null, suffix?: string | null): typeof ɵɵstyleProp;