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

Split <slot> into two features and add statuses #880

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

foolip
Copy link
Collaborator

@foolip foolip commented Apr 13, 2024

No description provided.

# Do not edit this file by hand. Edit the source file instead!

name: Imperative slot assignment
description: The `assign()` method for `<slot>` elements does TODO. Also known as manual slot assignment.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mfreed7 can you help me describe what this feature is? https://developer.mozilla.org/en-US/docs/Web/API/HTMLSlotElement/assign doesn't really say. I know it's the imperative alternative to the declarative method, but how to describe what it's for in simple terms?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I agree that the MDN description looks more or less like a copy of the spec. Not how a developer would understand it. Maybe this?


The assign() method of the HTMLSlotElement interface assigns the provided nodes to that slot, provided they are direct children of the shadow host. This allows the slotting behavior to be controlled via Javascript, rather than automatically by the browser based on matching up the slot and name attributes. For this reason, this feature is also known as "manual slot assignment".

In order for assign() to have any effect, the shadow root must have been created with the slotAssignment parameter set to "manual".


Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @mfreed7, that is very very helpful! I think we'll need to shorten it somewhat to fit our (self-imposed) length limit on descriptions, but I'll try to retain all the information.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's my updated wording:

Suggested change
description: The `assign()` method for `<slot>` elements does TODO. Also known as manual slot assignment.
description: The `assign()` method for `<slot>` elements assigns the given nodes to the slot. This allow you to control slotting using Javascript, as an alternative to using the `slot` and `name` HTML attributes. The nodes must be direct children of a shadow host and the shadow root must be created with the `slotAssignment `parameter set to "manual". Also known as manual slot assignment.

Differences to @mfreed7's suggestion explained:

@ddbeck ddbeck added feature definition Creating or defining new features or groups of features. and removed feature-definition labels Apr 15, 2024
@ddbeck ddbeck merged commit 377d7af into web-platform-dx:main Apr 22, 2024
3 checks passed
@foolip foolip deleted the slot-assign branch April 22, 2024 16:42
@foolip foolip mentioned this pull request Apr 29, 2024
foolip added a commit to foolip/browser-compat-data that referenced this pull request Jun 10, 2024
Elchi3 pushed a commit to mdn/browser-compat-data that referenced this pull request Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature definition Creating or defining new features or groups of features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants