diff --git a/packages/compiler/src/render3/r3_identifiers.ts b/packages/compiler/src/render3/r3_identifiers.ts index 3aeaf6bf8e..fdff4adff3 100644 --- a/packages/compiler/src/render3/r3_identifiers.ts +++ b/packages/compiler/src/render3/r3_identifiers.ts @@ -26,9 +26,9 @@ export class Identifiers { static elementAttribute: o.ExternalReference = {name: 'ɵa', moduleName: CORE}; - static elementClass: o.ExternalReference = {name: 'ɵk', moduleName: CORE}; + static elementClassNamed: o.ExternalReference = {name: 'ɵkn', moduleName: CORE}; - static elementStyle: o.ExternalReference = {name: 'ɵs', moduleName: CORE}; + static elementStyleNamed: o.ExternalReference = {name: 'ɵsn', moduleName: CORE}; static containerCreate: o.ExternalReference = {name: 'ɵC', moduleName: CORE}; diff --git a/packages/compiler/src/render3/r3_view_compiler.ts b/packages/compiler/src/render3/r3_view_compiler.ts index 2838568de4..dd0a10429d 100644 --- a/packages/compiler/src/render3/r3_view_compiler.ts +++ b/packages/compiler/src/render3/r3_view_compiler.ts @@ -210,8 +210,8 @@ function unsupported(feature: string): never { const BINDING_INSTRUCTION_MAP: {[index: number]: o.ExternalReference | undefined} = { [PropertyBindingType.Property]: R3.elementProperty, [PropertyBindingType.Attribute]: R3.elementAttribute, - [PropertyBindingType.Class]: R3.elementClass, - [PropertyBindingType.Style]: R3.elementStyle + [PropertyBindingType.Class]: R3.elementClassNamed, + [PropertyBindingType.Style]: R3.elementStyleNamed }; function interpolate(args: o.Expression[]): o.Expression { diff --git a/packages/core/src/core_render3_private_export.ts b/packages/core/src/core_render3_private_export.ts index fad17a4e60..6705744811 100644 --- a/packages/core/src/core_render3_private_export.ts +++ b/packages/core/src/core_render3_private_export.ts @@ -63,8 +63,8 @@ export { p as ɵp, pD as ɵpD, a as ɵa, - k as ɵk, - s as ɵs, + sn as ɵsn, + kn as ɵkn, t as ɵt, v as ɵv, st as ɵst, diff --git a/packages/core/src/render3/index.ts b/packages/core/src/render3/index.ts index 13d35a703a..f63c418eba 100644 --- a/packages/core/src/render3/index.ts +++ b/packages/core/src/render3/index.ts @@ -45,11 +45,11 @@ export { containerRefreshEnd as cr, elementAttribute as a, - elementClass as k, + elementClassNamed as kn, elementEnd as e, elementProperty as p, elementStart as E, - elementStyle as s, + elementStyleNamed as sn, listener as L, store as st, diff --git a/packages/core/src/render3/instructions.ts b/packages/core/src/render3/instructions.ts index 1627ad66e5..aa3ce2613f 100644 --- a/packages/core/src/render3/instructions.ts +++ b/packages/core/src/render3/instructions.ts @@ -875,7 +875,7 @@ function generatePropertyAliases(lNodeFlags: number, direction: BindingDirection * renaming as part of minification. * @param value A value indicating if a given class should be added or removed. */ -export function elementClass(index: number, className: string, value: T | NO_CHANGE): void { +export function elementClassNamed(index: number, className: string, value: T | NO_CHANGE): void { if (value !== NO_CHANGE) { const lElement = data[index] as LElementNode; if (value) { @@ -900,11 +900,11 @@ export function elementClass(index: number, className: string, value: T | NO_ * @param sanitizer An optional function used to transform the value typically used for * sanitization. */ -export function elementStyle( +export function elementStyleNamed( index: number, styleName: string, value: T | NO_CHANGE, suffix?: string): void; -export function elementStyle( +export function elementStyleNamed( index: number, styleName: string, value: T | NO_CHANGE, sanitizer?: Sanitizer): void; -export function elementStyle( +export function elementStyleNamed( index: number, styleName: string, value: T | NO_CHANGE, suffixOrSanitizer?: string | Sanitizer): void { if (value !== NO_CHANGE) { diff --git a/packages/core/test/render3/compiler_canonical/elements_spec.ts b/packages/core/test/render3/compiler_canonical/elements_spec.ts index 046a11a9d8..1700f7bf83 100644 --- a/packages/core/test/render3/compiler_canonical/elements_spec.ts +++ b/packages/core/test/render3/compiler_canonical/elements_spec.ts @@ -168,7 +168,7 @@ describe('elements', () => { $r3$.ɵE(0, 'div'); $r3$.ɵe(); } - $r3$.ɵk(0, 'foo', $r3$.ɵb(ctx.someFlag)); + $r3$.ɵkn(0, 'foo', $r3$.ɵb(ctx.someFlag)); } }); // /NORMATIVE @@ -202,8 +202,8 @@ describe('elements', () => { $r3$.ɵE(0, 'div'); $r3$.ɵe(); } - $r3$.ɵs(0, 'color', $r3$.ɵb(ctx.someColor)); - $r3$.ɵs(0, 'width', $r3$.ɵb(ctx.someWidth), 'px'); + $r3$.ɵsn(0, 'color', $r3$.ɵb(ctx.someColor)); + $r3$.ɵsn(0, 'width', $r3$.ɵb(ctx.someWidth), 'px'); } }); // /NORMATIVE @@ -251,7 +251,7 @@ describe('elements', () => { $r3$.ɵe(); } $r3$.ɵp(0, 'id', $r3$.ɵb(ctx.someString + 1)); - $r3$.ɵk(0, 'foo', $r3$.ɵb(ctx.someString == 'initial')); + $r3$.ɵkn(0, 'foo', $r3$.ɵb(ctx.someString == 'initial')); } }); // /NORMATIVE diff --git a/packages/core/test/render3/compiler_canonical/sanitize_spec.ts b/packages/core/test/render3/compiler_canonical/sanitize_spec.ts index fb2b82c1c2..e0671c8902 100644 --- a/packages/core/test/render3/compiler_canonical/sanitize_spec.ts +++ b/packages/core/test/render3/compiler_canonical/sanitize_spec.ts @@ -49,7 +49,7 @@ describe('compiler sanitization', () => { } $r3$.ɵp(0, 'innerHTML', $r3$.ɵb(ctx.innerHTML), $r3$.ɵsanitizeHtml); $r3$.ɵp(0, 'hidden', $r3$.ɵb(ctx.hidden)); - $r3$.ɵs(1, 'background-image', $r3$.ɵb(ctx.style), $r3$.ɵsanitizeStyle); + $r3$.ɵsn(1, 'background-image', $r3$.ɵb(ctx.style), $r3$.ɵsanitizeStyle); $r3$.ɵp(1, 'src', $r3$.ɵb(ctx.url), $r3$.ɵsanitizeUrl); $r3$.ɵa(1, 'srcset', $r3$.ɵb(ctx.url), $r3$.ɵsanitizeUrl); } diff --git a/packages/core/test/render3/exports_spec.ts b/packages/core/test/render3/exports_spec.ts index a224965faa..7638e0b1a1 100644 --- a/packages/core/test/render3/exports_spec.ts +++ b/packages/core/test/render3/exports_spec.ts @@ -7,7 +7,7 @@ */ import {defineComponent, defineDirective} from '../../src/render3/index'; -import {bind, container, containerRefreshEnd, containerRefreshStart, elementAttribute, elementClass, elementEnd, elementProperty, elementStart, embeddedViewEnd, embeddedViewStart, load, text, textBinding} from '../../src/render3/instructions'; +import {bind, container, containerRefreshEnd, containerRefreshStart, elementAttribute, elementClassNamed, elementEnd, elementProperty, elementStart, embeddedViewEnd, embeddedViewStart, load, text, textBinding} from '../../src/render3/instructions'; import {renderToHtml} from './render_util'; @@ -169,7 +169,7 @@ describe('exports', () => { elementEnd(); } let myInput = elementStart(1); - elementClass(0, 'red', bind(myInput && (myInput as any).checked)); + elementClassNamed(0, 'red', bind(myInput && (myInput as any).checked)); } expect(renderToHtml(Template, {})) diff --git a/packages/core/test/render3/instructions_spec.ts b/packages/core/test/render3/instructions_spec.ts index d2e616a56f..392a4ef9a9 100644 --- a/packages/core/test/render3/instructions_spec.ts +++ b/packages/core/test/render3/instructions_spec.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {elementAttribute, elementEnd, elementProperty, elementStart, elementStyle, renderTemplate} from '../../src/render3/instructions'; +import {elementAttribute, elementEnd, elementProperty, elementStart, elementStyleNamed, renderTemplate} from '../../src/render3/instructions'; import {LElementNode, LNode} from '../../src/render3/interfaces/node'; import {RElement, domRendererFactory3} from '../../src/render3/interfaces/renderer'; import {bypassSanitizationTrustStyle, bypassSanitizationTrustUrl, sanitizeStyle, sanitizeUrl} from '../../src/sanitization/sanitization'; @@ -55,15 +55,15 @@ describe('instructions', () => { }); }); - describe('elementStyle', () => { + describe('elementStyleNamed', () => { it('should use sanitizer function', () => { const t = new TemplateFixture(createDiv); - t.update(() => elementStyle(0, 'background-image', 'url("http://server")', sanitizeStyle)); + t.update(() => elementStyleNamed(0, 'background-image', 'url("http://server")', sanitizeStyle)); // nothing is set because sanitizer suppresses it. expect(t.html).toEqual('
'); t.update( - () => elementStyle( + () => elementStyleNamed( 0, 'background-image', bypassSanitizationTrustStyle('url("http://server")'), sanitizeStyle)); expect((t.hostElement.firstChild as HTMLElement).style.getPropertyValue('background-image')) diff --git a/packages/core/test/render3/integration_spec.ts b/packages/core/test/render3/integration_spec.ts index b2b9c66103..a24ff283ec 100644 --- a/packages/core/test/render3/integration_spec.ts +++ b/packages/core/test/render3/integration_spec.ts @@ -7,7 +7,7 @@ */ import {defineComponent, defineDirective} from '../../src/render3/index'; -import {NO_CHANGE, bind, container, containerRefreshEnd, containerRefreshStart, elementAttribute, elementClass, elementEnd, elementProperty, elementStart, elementStyle, embeddedViewEnd, embeddedViewStart, interpolation1, interpolation2, interpolation3, interpolation4, interpolation5, interpolation6, interpolation7, interpolation8, interpolationV, load, projection, projectionDef, text, textBinding} from '../../src/render3/instructions'; +import {NO_CHANGE, bind, container, containerRefreshEnd, containerRefreshStart, elementAttribute, elementClassNamed, elementEnd, elementProperty, elementStart, elementStyleNamed, embeddedViewEnd, embeddedViewStart, interpolation1, interpolation2, interpolation3, interpolation4, interpolation5, interpolation6, interpolation7, interpolation8, interpolationV, load, projection, projectionDef, text, textBinding} from '../../src/render3/instructions'; import {containerEl, renderToHtml} from './render_util'; @@ -659,7 +659,7 @@ describe('render3 integration test', () => { elementStart(0, 'span'); elementEnd(); } - elementStyle(0, 'border-color', bind(ctx)); + elementStyleNamed(0, 'border-color', bind(ctx)); } expect(renderToHtml(Template, 'red')).toEqual(''); @@ -674,7 +674,7 @@ describe('render3 integration test', () => { elementStart(0, 'span'); elementEnd(); } - elementStyle(0, 'font-size', bind(ctx), 'px'); + elementStyleNamed(0, 'font-size', bind(ctx), 'px'); } expect(renderToHtml(Template, '100')).toEqual(''); @@ -691,7 +691,7 @@ describe('render3 integration test', () => { elementStart(0, 'span'); elementEnd(); } - elementClass(0, 'active', bind(ctx)); + elementClassNamed(0, 'active', bind(ctx)); } expect(renderToHtml(Template, true)).toEqual(''); @@ -712,7 +712,7 @@ describe('render3 integration test', () => { elementStart(0, 'span', ['class', 'existing']); elementEnd(); } - elementClass(0, 'active', bind(ctx)); + elementClassNamed(0, 'active', bind(ctx)); } expect(renderToHtml(Template, true)).toEqual('');