Description
When replacing all children of a node, via textContent
for example, removing each child of the node results in the invocation of the concept to assign slotables for a tree.
For example, consider the following shadow tree:
<p id="target"><slot id="slot1"></slot><slot id="slot2"></slot><slot id="slot3"></slot></p>
If target.textContent = ''
is evaluated, it would result in the removal of slot1
, followed by that of slot2
and slot3
. As a result, we would fire slotchange
event on slot2
and slot3
despite of the fact those slots would have never been "rendered" with assigned nodes in practice.
This results in slotchange
event handlers of slot2
and slot3
potentially doing unnecessary & useless work.
Relatedly, Firefox's implementation seems to fire slotchange
on slot2
& slot3
when target.remove()
is evaluated, which seems wrong because the time at which the concept to assign slotables for a tree is evaluated, slot2
and slot3
are no longer in the tree.
See https://gist.github.com/rniwa/1a24c77317a50785ae8885e58f35966c for the demo.
Activity