MCPcopy Create free account
hub / github.com/UI5/webcomponents / _clearSlot

Function _clearSlot

packages/base/src/UI5Element.ts:623–640  ·  view source on GitHub ↗

* Removes all children from the slot and detaches listeners, if any * @private

(slotName: string, slotData: SlotMetadata)

Source from the content-addressed store, hash-verified

621 * @private
622 */
623 _clearSlot(slotName: string, slotData: SlotMetadata) {
624 const propertyName = slotData.propertyName || slotName;
625 const children = this._state[propertyName] as Array<SlotValue>;
626
627 children.forEach(child => {
628 if (instanceOfUI5Element(child)) {
629 const childChangeListener = this._getChildChangeListener(slotName);
630 child.detachInvalidate.call(child, childChangeListener);
631 }
632
633 if (child instanceof HTMLSlotElement) {
634 this._detachSlotChange(child, slotName);
635 }
636 });
637
638 this._state[propertyName] = [];
639 this._state[kebabToCamelCase(propertyName)] = this._state[propertyName];
640 }
641
642 /**
643 * Attach a callback that will be executed whenever the component is invalidated

Callers

nothing calls this directly

Calls 1

kebabToCamelCaseFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…