ui5-webcomponents icon indicating copy to clipboard operation
ui5-webcomponents copied to clipboard

feat(UI5Element): invalidateOnChildChange works for slots

Open vladitasev opened this issue 1 year ago • 0 comments

Currently, the slot metadata setting invalidateOnChildChange only works for directly slotted UI5 Elements inside the slot.

This change enables the functionality for transitively slotted children too. This is relevant for <ui5-multi-input> which uses internally <ui5-tokenizer> and the <ui5-token>s are transitively slotted from the MultiInput to the Tokenizer, and finally the Tokenizer gets each token wrapped in a <slot> element.

Notes:

  • the _getChildChangeListener method's return value is always truthy, it doesn't need to be checked
  • unfortunately the slotchange event does not provide information on added/removed nodes (unlike f.e. MutationObserver), therefore a WeakMap is used to store all children per slot between slotchange calls.

related to: https://github.com/SAP/ui5-webcomponents/pull/9005

vladitasev avatar May 21 '24 12:05 vladitasev