Skip to content

Commit 617e8e3

Browse files
committed
fix: prevent duplicates
1 parent 6f6a24a commit 617e8e3

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

packages/svelte/src/internal/server/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,10 @@ export function spread_attributes(attrs, css_hash, classes, styles, flags = 0) {
205205
if (!ignore_defaults) {
206206
if (name === 'defaultvalue') {
207207
name = 'value';
208+
if (attrs[name]) continue;
208209
} else if (name === 'defaultchecked') {
209210
name = 'checked';
211+
if (attrs[name]) continue;
210212
}
211213
}
212214

packages/svelte/tests/runtime-runes/samples/form-default-value-from-spread/_config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@ export default test({
55
html: `
66
<input value="a">
77
<input type="checkbox" checked>
8+
<input value="b">
9+
<input type="checkbox">
810
`
911
});

packages/svelte/tests/runtime-runes/samples/form-default-value-from-spread/main.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
</script>
55

66
<input {...text} />
7-
<input type="checkbox" {...checkbox} />
7+
<input type="checkbox" {...checkbox} />
8+
<input value="b" {...text} />

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy