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

[slottable-request] Use Symbol.for() for the remove sentinel value #69

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Changes from all commits
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
4 changes: 2 additions & 2 deletions proposals/slottable-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class SlottableRequestEvent<Name extends string, T = unknown> extends Eve
}
}

export const remove = Symbol('slottable-request-remove');
export const remove = Symbol.for('slottable-request-remove');
```

When a component wants to render customizable content, it (1) fires a `slottable-request` event for a given slot name, and (2) renders a `<slot>` element into its shadow root corresponding to the requested slot name.
Expand All @@ -64,7 +64,7 @@ Because components may request multiple slotted instances for the same conceptua

When requesting a specific slot instance, the event accepts an optional 3rd `key` argument; this is used to generate a unique `slotName` by suffixing the `name` with `key`.

The `remove` symbol is provided as a sentinel value for `data` to indicate that the given content assigned to `slotName` should be removed, and should be fired when the associated `<slot>` is no longer rendered to avoid leaking light-DOM children.
The `remove` symbol is provided as a sentinel value for `data` to indicate that the given content assigned to `slotName` should be removed, and should be fired when the associated `<slot>` is no longer rendered to avoid leaking light-DOM children. It's defined as `Symbol.for('slottable-request-remove')` so it can be shared between several implementations and make them interoperable.


## Examples
Expand Down