Skip to content

Commit db19df8

Browse files
committed
chore: update
1 parent 2d7e5af commit db19df8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/runtime-dom/src/apiCustomElement.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -627,13 +627,16 @@ export class VueElement
627627
* Only called when shadowRoot is false
628628
*/
629629
private _parseSlots(remove: boolean = true) {
630+
if (!this._slotNames) this._slotNames = new Set()
631+
else this._slotNames.clear()
632+
630633
const slots: VueElement['_slots'] = (this._slots = {})
631634
let n = this.firstChild
632635
while (n) {
633636
const slotName =
634637
(n.nodeType === 1 && (n as Element).getAttribute('slot')) || 'default'
635638
;(slots[slotName] || (slots[slotName] = [])).push(n)
636-
;(this._slotNames || (this._slotNames = new Set())).add(slotName)
639+
this._slotNames.add(slotName)
637640
const next = n.nextSibling
638641
if (remove) this.removeChild(n)
639642
n = next
@@ -728,10 +731,10 @@ export class VueElement
728731

729732
// switch between fallback and provided content
730733
if (this._slotFallbacks) {
731-
const oldSlotNames = Object.keys(this._slots!)
734+
const oldSlotNames = Array.from(this._slotNames!)
732735
// re-parse slots
733736
this._parseSlots(false)
734-
const newSlotNames = Object.keys(this._slots!)
737+
const newSlotNames = Array.from(this._slotNames!)
735738
const allSlotNames = new Set([...oldSlotNames, ...newSlotNames])
736739
allSlotNames.forEach(name => {
737740
const fallbackNodes = this._slotFallbacks![name]

0 commit comments

Comments
 (0)