fix: allow `bind:this` on `<select>` with dynamic `multiple` attribute (#11378)

fixes #11377
pull/11335/head
Simon H 7 months ago committed by GitHub
parent 500b2065e0
commit 4479b8c6f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
"svelte": patch
---
fix: allow `bind:this` on `<select>` with dynamic `multiple` attribute

@ -413,7 +413,7 @@ const validation = {
}
}
if (parent.name === 'select') {
if (parent.name === 'select' && node.name !== 'this') {
const multiple = parent.attributes.find(
(a) =>
a.type === 'Attribute' &&

@ -3,11 +3,11 @@
"code": "attribute_invalid_multiple",
"message": "'multiple' attribute must be static if select uses two-way binding",
"start": {
"line": 6,
"line": 14,
"column": 19
},
"end": {
"line": 6,
"line": 14,
"column": 29
}
}

@ -3,6 +3,14 @@
let multiple;
</script>
<!-- ok -->
<select bind:this={value} {multiple}>
<option>1</option>
<option>2</option>
<option>3</option>
</select>
<!-- error -->
<select bind:value {multiple}>
<option>1</option>
<option>2</option>

Loading…
Cancel
Save