Skip to content

Commit e9d58e2

Browse files
committed
tighten up
1 parent 80d1ee2 commit e9d58e2

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

packages/svelte/src/internal/client/render.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2843,17 +2843,13 @@ export function spread_attributes(dom, prev, attrs, css_hash) {
28432843
if (!setters) map_set(setters_cache, dom.nodeName, (setters = get_setters(dom)));
28442844

28452845
for (const key in next) {
2846-
if (key.startsWith('$$')) continue;
2847-
28482846
let value = next[key];
2849-
if (has_hash && key === 'class') {
2850-
if (value) value += ' ';
2851-
value += css_hash;
2852-
}
2853-
28542847
if (value === prev?.[key]) continue;
28552848

2856-
if (key.startsWith('on')) {
2849+
const prefix = key.slice(0, 2);
2850+
if (prefix === '$$') continue;
2851+
2852+
if (prefix === 'on') {
28572853
// TODO delegate?
28582854
/** @type {{ capture?: true }} */
28592855
const opts = {};
@@ -2895,6 +2891,11 @@ export function spread_attributes(dom, prev, attrs, css_hash) {
28952891
dom[key] = value;
28962892
}
28972893
} else if (typeof value !== 'function') {
2894+
if (has_hash && key === 'class') {
2895+
if (value) value += ' ';
2896+
value += css_hash;
2897+
}
2898+
28982899
attr(dom, key, value);
28992900
}
29002901
}

0 commit comments

Comments
 (0)