Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select multiple value does not get set with spread props #4392

Closed
nathancahill opened this issue Feb 9, 2020 · 3 comments · Fixed by #4894
Closed

Select multiple value does not get set with spread props #4392

nathancahill opened this issue Feb 9, 2020 · 3 comments · Fixed by #4894
Labels

Comments

@nathancahill
Copy link

nathancahill commented Feb 9, 2020

Describe the bug

This works:

<script>
  let value = ['Hello', 'World'];
</script>

<select multiple {value}>
  <option>Hello</option>
  <option>World</option>
</select>

Adding any type of spread, even an empty object {...{}}, causes the value not to be set:

<script>
  let value = ['Hello', 'World'];
</script>

<select multiple {value} {...{}}>
  <option>Hello</option>
  <option>World</option>
</select>

Logs
No logs.

To Reproduce
https://svelte.dev/repl/99bd5ebecc464e328972252e287ab716?version=3.18.1

Expected behavior
The <select multiple> value should be set.

Stacktraces
No stacktrace.

Information about your Svelte project:

  • Your browser and the version: Firefox 72, Chrome 80, Safari 13

  • Your operating system: OS X 10.14.6

  • Svelte version: 3.18.1

  • Rollup

Severity
Mildly annoying, needed to build a complex workaround for a simple thing.

Additional Context
Further debugging, it seems like the issue might be related to this line in Element/Binding.ts#L212

The check is node.get_static_attribute_value('multiple') === true. Adding a spread causes this check fail.

@Conduitry
Copy link
Member

I believe this is another manifestation of #3680 and that both could be fixed together.

@Conduitry
Copy link
Member

@nathancahill
Copy link
Author

Awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants