Imperative slot assignment
Newly available since 2023-03-27
The assign()
method for <slot>
elements assigns nodes to the slot, as an alternative to using the slot
and name
HTML attributes. The nodes must be children of a shadow host and the shadow root must be created with the slotAssignment
set to "manual". Also known as manual slot assignment.
Learning resources on MDN
Browser support
- Chrome 86 Released on 2020-10-20
- Chrome Android 86 Released on 2020-10-20
- Edge 86 Released on 2020-10-09
- Firefox 92 Released on 2021-09-07
- Firefox for Android 92 Released on 2021-09-07
- Safari 16.4 Released on 2023-03-27
- Safari on iOS 16.4 Released on 2023-03-27
Surveys
- State of HTML 2024: web_components/web_components_features question
- State of HTML 2024: web_components/web_component_features question
- State of HTML 2024: features/all_features question
- State of HTML 2023: web_components/web_components_main_features question
- State of HTML 2023: features/all_features question
Specifications
- HTML (#dom-slot-assign), from HTML Workstream (WHATWG).
View web-platform-tests results for this feature - View the feature source file (dist) - Edit the feature - Report an issue about this feature