Skip to content

Commit 906eb94

Browse files
committed
skip arg where possible
1 parent 8bafc73 commit 906eb94

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

packages/svelte/src/compiler/phases/3-transform/client/visitors/RegularElement.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ function build_element_spread_attributes(
486486
b.id(id),
487487
b.object(values),
488488
lowercase_attributes,
489-
b.literal(context.state.analysis.css.hash),
489+
context.state.analysis.css.hash !== '' && b.literal(context.state.analysis.css.hash),
490490
is_ignored(element, 'hydration_attribute_changed') && b.true
491491
)
492492
)

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export function set_custom_element_data(node, prop, value) {
148148
* @param {Record<string, any> | undefined} prev
149149
* @param {Record<string, any>} next New attributes - this function mutates this object
150150
* @param {boolean} lowercase_attributes
151-
* @param {string} css_hash
151+
* @param {string} [css_hash]
152152
* @param {boolean} [skip_warning]
153153
* @returns {Record<string, any>}
154154
*/
@@ -162,7 +162,7 @@ export function set_attributes(element, prev, next, lowercase_attributes, css_ha
162162
}
163163
}
164164

165-
if (css_hash !== '') {
165+
if (css_hash !== undefined) {
166166
next.class = next.class ? next.class + ' ' + css_hash : css_hash;
167167
}
168168

@@ -305,15 +305,15 @@ export function set_attributes(element, prev, next, lowercase_attributes, css_ha
305305
* @param {Record<string, any>} next The new attributes - this function mutates this object
306306
* @param {string} [css_hash]
307307
*/
308-
export function set_dynamic_element_attributes(node, prev, next, css_hash = '') {
308+
export function set_dynamic_element_attributes(node, prev, next, css_hash) {
309309
if (node.tagName.includes('-')) {
310310
for (var key in prev) {
311311
if (!(key in next)) {
312312
next[key] = null;
313313
}
314314
}
315315

316-
if (css_hash !== '') {
316+
if (css_hash !== undefined) {
317317
next.class = next.class ? next.class + ' ' + css_hash : css_hash;
318318
}
319319

0 commit comments

Comments
 (0)