-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Error compiling component when <option> without value attribute contains <slot /> #2723
Comments
You are on a roll @trbrc. Thank you so much! It's very much appreciated! It seems that an |
Svelte can't currently handle anything other than pure text as option content if no I'm not sure how far we want to go with this. Possibly walk the option content and concatenate all the text (like the browser does), and take the slot content if it's a |
@Conduitry I just saw the request for clarification. What kind of clarification are you looking for? I realize this is not a high priority bug, as it's a corner case with low real world impact, but I would suggest it's a bug rather than request for enhancement. Getting a vague compiler error in this scenario can't be the correct behavior, and it's not obvious that adding the |
Changing to bug as I can see that this isn't the correct behaviour given the REPL. What the correct behaviour (gracefully just render, or add a dev warning) is though, I don't know. |
This works in Svelte 5 |
A component with an
<option>
tag that has novalue
attribute and contains another tag, such as<slot />
, will refuse to compile with a vague error:Reproduction: https://svelte.dev/repl/676c6c2d7a8a4684a261935c488b763a?version=3.20.1
Changing it to
<option value><slot/></option>
is enough to make it work.The text was updated successfully, but these errors were encountered: