From 4479b8c6f316edc29881e97f6160b347fc35217e Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Mon, 29 Apr 2024 18:16:52 +0200 Subject: [PATCH] fix: allow `bind:this` on `` with dynamic `multiple` attribute diff --git a/packages/svelte/src/compiler/phases/2-analyze/validation.js b/packages/svelte/src/compiler/phases/2-analyze/validation.js index ab793bf1a7..c2c7dece31 100644 --- a/packages/svelte/src/compiler/phases/2-analyze/validation.js +++ b/packages/svelte/src/compiler/phases/2-analyze/validation.js @@ -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' && diff --git a/packages/svelte/tests/validator/samples/binding-select-multiple-dynamic/errors.json b/packages/svelte/tests/validator/samples/binding-select-multiple-dynamic/errors.json index 9506d800ee..8430d40d61 100644 --- a/packages/svelte/tests/validator/samples/binding-select-multiple-dynamic/errors.json +++ b/packages/svelte/tests/validator/samples/binding-select-multiple-dynamic/errors.json @@ -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 } } diff --git a/packages/svelte/tests/validator/samples/binding-select-multiple-dynamic/input.svelte b/packages/svelte/tests/validator/samples/binding-select-multiple-dynamic/input.svelte index 6fb0df4d47..4908672985 100644 --- a/packages/svelte/tests/validator/samples/binding-select-multiple-dynamic/input.svelte +++ b/packages/svelte/tests/validator/samples/binding-select-multiple-dynamic/input.svelte @@ -3,6 +3,14 @@ let multiple; + + + +