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

Top-level option throws compiler error #2750

Closed
timhall opened this issue May 13, 2019 · 2 comments
Closed

Top-level option throws compiler error #2750

timhall opened this issue May 13, 2019 · 2 comments

Comments

@timhall
Copy link
Contributor

timhall commented May 13, 2019

The following component throws this.start is undefined / Cannot read property 'start' of undefined:

<option {...$$props}><slot /></option>

Repro: https://svelte.dev/repl/0f910ce8e15641c789ef8f6f00be91a6?version=3.3.0

I was able to get around it by explicitly setting value on the option, but that was only after some trial-and-error:

<script>
  export let value;
</script>

<option {value} {...$$props}><slot /></option>
Stack trace
TypeError: Cannot read property 'start' of undefined
    at Expression.render (C:\dev\svelte-elements\node_modules\svelte\compiler.js:21181:48)
    at Attribute$1.get_value (C:\dev\svelte-elements\node_modules\svelte\compiler.js:21427:35)
    at node.attributes.filter.forEach.attr (C:\dev\svelte-elements\node_modules\svelte\compiler.js:16047:83)
    at Array.forEach ()
    at ElementWrapper.add_spread_attributes (C:\dev\svelte-elements\node_modules\svelte\compiler.js:16037:15)
    at ElementWrapper.add_attributes (C:\dev\svelte-elements\node_modules\svelte\compiler.js:16020:19)
    at ElementWrapper.render (C:\dev\svelte-elements\node_modules\svelte\compiler.js:15836:15)
    at FragmentWrapper.render (C:\dev\svelte-elements\node_modules\svelte\compiler.js:17527:28)
    at new Renderer (C:\dev\svelte-elements\node_modules\svelte\compiler.js:17558:24)
    at dom (C:\dev\svelte-elements\node_modules\svelte\compiler.js:17749:23)
@EmilTholin
Copy link
Member

Possibly related to #2723.

@timhall
Copy link
Contributor Author

timhall commented May 13, 2019

Goodness, not sure why that didn't come up in search. Thanks @EmilTholin, closing as duplicate

@timhall timhall closed this as completed May 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants