-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Labels
feature / enhancementNew feature or requestNew feature or requestsvelteThis feature can't be implemented without changes to Svelte itselfThis feature can't be implemented without changes to Svelte itself
Milestone
Description
Let's say I have a _layout.svelte like the following:
<slot name="layout-pre"></slot>
<div id="intermediate">Some other intermediate stuff.</div>
<slot></slot>And now I have a child view (let's call it homepage.svelte which inherits that layout, which puts some stuff into the named slot, and the rest into the default slot:
<h1 slot="layout-pre">This should come before #intermediate.</h1>
<!-- When rendered, the div from above should get inserted here from the layout:
<div id="intermediate">Some other intermediate stuff.</div>
-->
<main>Since this doesn't use a named slot, it'll just get inserted into the unnamed slot above.</main>Right now this is not allowed, and the following error is thrown: Element with a slot='...' attribute must be a descendant of a component or custom element. Are there technical or usage reasons why we wouldn't want to treat a layout like any other component with respect to slots?
aromanarguello, nksfrank, nelsonpecora, joakim, alexdilley and 322 moreBeyondoximus, n3dst4, lucavenir, oscarhermoso, davemaul and 21 moreumwwwelt, GeneralMine, pdaddyo, hirokbanik, n3dst4 and 21 more
Metadata
Metadata
Assignees
Labels
feature / enhancementNew feature or requestNew feature or requestsvelteThis feature can't be implemented without changes to Svelte itselfThis feature can't be implemented without changes to Svelte itself