The final imperative slot distribution API spec has been landed at [1]. There are minor changes from the initial draft [2] which was implemented in Chromium. This feature represents the changes from the draft to the final spec. [1] https://html.spec.whatwg.org/#dom-slot-assign [2] https://chromestatus.com/feature/5711021289242624

Motivation

In landing the final spec, there was some additional work done to shape the API. In particular, there was a desire to more closely align the way node references work to the emerging AOM node references proposal. See comments at [1] and [2]. The differences are: 1. Assignments between nodes and slots are more "permanent", and are not removed if either slots or nodes are moved around the tree or among documents. Exceptions will not be thrown from .assign() for slots or nodes "in the wrong spot". 2. The slot assignment mode "auto" has been renamed to "named", to allow additional values to be used later. 3. Repeated nodes in a call to .assign() will now be ordered first-in-first-out order. Previously, assign([a,b,a]) would result in [b,a] ordering. Now, it will result in [a,b] ordering. 4. The parameter(s) to .assign() are now passed in as a variadic list of nodes (e.g. slot.assign(n1,n2,n3)) rather than a single sequence argument (e.g. slot.assign([n1,n2,n2])). [1] https://github.com/whatwg/html/pull/6561/files [2] https://github.com/whatwg/dom/pull/966

Status in Chromium


Consensus & Standardization

After a feature ships in Chrome, the values listed here are not guaranteed to be up to date.

Last updated on 2021-07-27