-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Closed
Description
In the following abbreviated components I'd expect to have access to foo
in the h1 class attribute. But instead it's only accessible inside the slotted element content.
Parent
<Child {baz}>
Content
<h1 slot=foobar let:foo class='foobar-{foo.type}'>{foo.title}!</h1>
<!-- Unexpected behaviour is here - - ^ ^- - - This works fine -->
</Child>
Child
<section class=child>
<slot name=foobar foo={makeFoo(baz)} />
{@html baz.content}
</Child>
I'd like the above example to work, with slot let
variables in scope at the root slotted element
Alternatives to this include:
- Wrapping in a dummy element. (Yuck)
bind:this
and manually setting the attributes I want later. (Ulcer inducing)
This is pretty important for slotting tables: if you can't use data from the dataset to add attributes to slotted rows or cells you're missing something pretty darn important...
matthieugicquel
Metadata
Metadata
Assignees
Labels
No labels