Skip to content

Commit

Permalink
perf: should patch string style when value is changed
Browse files Browse the repository at this point in the history
  • Loading branch information
underfin committed Jun 6, 2020
1 parent 4a5021e commit 4c31a9e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/runtime-dom/src/modules/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ export function patchStyle(el: Element, prev: Style, next: Style) {
if (!next) {
el.removeAttribute('style')
} else if (isString(next)) {
style.cssText = next
if (prev !== next) {
style.cssText = next
}
} else {
for (const key in next) {
setStyle(style, key, next[key] as string)
Expand Down

0 comments on commit 4c31a9e

Please sign in to comment.