fix: `bind:value` to select with stores (#16028)

Co-authored-by: Rich Harris <rich.harris@vercel.com>
pull/16029/head
Paolo Ricciuti 3 months ago committed by GitHub
parent c53ef5ce60
commit 3ea2dbc6a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: `bind:value` to select with stores

@ -119,8 +119,8 @@ export function RegularElement(node, context) {
'=',
left,
value.expression.type === 'SequenceExpression'
? b.call(value.expression.expressions[0])
: value.expression
? /** @type {Expression} */ (context.visit(b.call(value.expression.expressions[0])))
: /** @type {Expression} */ (context.visit(value.expression))
)
)
);

@ -0,0 +1 @@
<select><option value="">--Please choose an option--</option><option value="dog" selected>Dog</option><option value="cat">Cat</option></select>

@ -0,0 +1,10 @@
<script>
import { writable } from 'svelte/store';
const value = writable('dog');
</script>
<select bind:value={$value}>
<option value="">--Please choose an option--</option>
<option value="dog">Dog</option>
<option value="cat">Cat</option>
</select>
Loading…
Cancel
Save