[whatwg/dom] A slottable's assigned slot is never reset (Issue #1352)

### What is the issue with the DOM Standard?

When [assigning slottables](https://dom.spec.whatwg.org/#assign-slotables) for a slot, the spec updates the assigned slot of any slottable that is added to the slot in
> 4. For each slottable of slottables, set slottable’s [assigned slot](https://dom.spec.whatwg.org/#slotable-assigned-slot) to slot.

However, the [assigned slot](https://dom.spec.whatwg.org/#slotable-assigned-slot)  of any slottables that were previously assigned to the slot but aren't anymore won't change. I would expect a slottable's [assigned slot](https://dom.spec.whatwg.org/#slotable-assigned-slot) to be null if that slottable is not also part of that slot's [assigned nodes](https://dom.spec.whatwg.org/#slot-assigned-nodes).

I'm not sure if this is intended, because the [`assignedSlot`](https://dom.spec.whatwg.org/#dom-slotable-assignedslot) getter for slottables seems to work around it by calling [find a slot](https://dom.spec.whatwg.org/#find-a-slot).

This is causing extra work in algorithms like [Node::remove](https://dom.spec.whatwg.org/#concept-node-remove):
> If node is [assigned](https://dom.spec.whatwg.org/#slotable-assigned), then run [assign slottables](https://dom.spec.whatwg.org/#assign-slotables) for node’s [assigned slot](https://dom.spec.whatwg.org/#slotable-assigned-slot).

If the node was previously removed from a slot (but keeps a nonnull [assigned slot](https://dom.spec.whatwg.org/#slotable-assigned-slot)) then this won't do anything. 



-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/1352
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/issues/1352@github.com>

Received on Saturday, 1 February 2025 09:59:27 UTC