File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff 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 ]
You can’t perform that action at this time.
0 commit comments