Skip to content

Commit c7c1ade

Browse files
committed
tweak
1 parent a7a17b6 commit c7c1ade

File tree

1 file changed

+7
-2
lines changed
  • packages/svelte/src/internal/client/dom/elements

1 file changed

+7
-2
lines changed

packages/svelte/src/internal/client/dom/elements/style.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ import { hydrating } from '../hydration.js';
88
* @param {string} [priority]
99
*/
1010
function update_styles(dom, prev = {}, next, priority) {
11-
for (const key in next) {
12-
const value = next[key];
11+
for (var key in next) {
12+
var value = next[key];
13+
1314
if (prev[key] !== value) {
1415
if (next[key] == null) {
1516
dom.style.removeProperty(key);
@@ -29,15 +30,18 @@ function update_styles(dom, prev = {}, next, priority) {
2930
export function set_style(dom, value, prev_styles, next_styles) {
3031
// @ts-expect-error
3132
var prev = dom.__style;
33+
3234
if (hydrating || prev !== value) {
3335
var next_style_attr = to_style(value, next_styles);
36+
3437
if (!hydrating || next_style_attr !== dom.getAttribute('style')) {
3538
if (next_style_attr == null) {
3639
dom.removeAttribute('style');
3740
} else {
3841
dom.style.cssText = next_style_attr;
3942
}
4043
}
44+
4145
// @ts-expect-error
4246
dom.__style = value;
4347
} else if (next_styles) {
@@ -48,5 +52,6 @@ export function set_style(dom, value, prev_styles, next_styles) {
4852
update_styles(dom, prev_styles, next_styles);
4953
}
5054
}
55+
5156
return next_styles;
5257
}

0 commit comments

Comments
 (0)