Skip to content

Commit

Permalink
fixup! perf(ivy): apply static styles/classes directly to an element'…
Browse files Browse the repository at this point in the history
…s style/className properties
  • Loading branch information
mhevery committed Oct 25, 2019
1 parent 730ee6f commit 1204c2b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 1 addition & 3 deletions packages/core/src/render3/instructions/styling.ts
Expand Up @@ -441,9 +441,7 @@ function normalizeStylingDirectiveInputValue(
if (isClassBased) {
value = concatString(initialValue, forceClassesAsString(bindingValue));
} else {
value = concatString(
initialValue,
forceStylesAsString(bindingValue as{[key: string]: any} | null | undefined, true), ';');
value = concatString(initialValue, forceStylesAsString(bindingValue, true), ';');
}
}
return value;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/render3/styling/bindings.ts
Expand Up @@ -752,7 +752,7 @@ export function writeStylingValueDirectly(
}
setClassName(renderer, element, valueToApply);
} else {
valueToApply = forceStylesAsString(value as{[key: string]: any}, true);
valueToApply = forceStylesAsString(value, true);
if (initialValue !== null) {
valueToApply = initialValue + ';' + valueToApply;
}
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/render3/util/styling_utils.ts
Expand Up @@ -296,7 +296,8 @@ export function forceClassesAsString(classes: string | {[key: string]: any} | nu
}

export function forceStylesAsString(
styles: {[key: string]: any} | null | undefined, hyphenateProps: boolean): string {
styles: {[key: string]: any} | string | null | undefined, hyphenateProps: boolean): string {
if (typeof styles == 'string') return styles;
let str = '';
if (styles) {
const props = Object.keys(styles);
Expand Down

0 comments on commit 1204c2b

Please sign in to comment.