8000 Targeted Slots - passing and mixing attributes and styles to component, access the slotted element from inside the component by lukaszpolowczyk · Pull Request #68 · sveltejs/rfcs · GitHub
[go: up one dir, main page]

Skip to content

Targeted Slots - passing and mixing attributes and styles to component, access the slotted element from inside the component #68

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

Closed
wants to merge 20 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
info about no idea for multiple use:action and typo
  • Loading branch information
lukaszpolowczyk authored Jan 5, 2023
commit 90b3af124c3ff76a5329c8baeae2cb92a87f2149
12 changes: 10 additions & 2 deletions text/0000-targeted-slots.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Using `let:val`.

```svelte
<!-- Parent.svelte -->
<Child><svelte:element slot="name"/ let:val>{val}</svelte:element></Child>
<Child><svelte:element slot="name" let:val>{val}</svelte:element></Child>
```

---
Expand Down Expand Up @@ -238,7 +238,8 @@ Allows to hide complex logic in `Child`, hidden under a simple element visible i

Declarative Actions is the idea that for `use:Component` you can use a `Component`, with `<target bind:this={target}>` in the `Component`, to be able to use the advantages of SvelteJS syntax, and at the same time use the advantages of actions.

My proposal also does this, but in a different (more universal and without using the action attribute) way.
My proposal also does this, but in a different (more universal and without using the action attribute) way.
But I found that Targeted Slots does not have the equivalent of using multiple `use:action1 use:action2` in a single element. This is one of the Unresolved questions.

---

Expand Down Expand Up @@ -665,6 +666,13 @@ Perhaps a new syntax `bind:these={els]` is needed?
<Child><svelte:element slot="name" bind:these={els}/></Child>
```

---

Targeted Slots does not have the equivalent of using multiple `use:action1 use:action2` in a single element.
This was pointed out by user mimbrown.

So far I have no idea how to solve this.

### Rejected at this time

The attribute value written in `Parent`, should overwrite the attribute value written in `Child`.
Expand Down
0