Skip to content

Commit 238619c

Browse files
committed
chore: tweaks
1 parent bcd5730 commit 238619c

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

packages/runtime-dom/src/apiCustomElement.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ export class VueElement
635635
* Only called when shadowRoot is false
636636
*/
637637
private _renderSlots() {
638-
const outlets = [...getSlots(this._teleportTargets), ...getSlots([this])]
638+
const outlets = this._getSlots()
639639
const scopeId = this._instance!.type.__scopeId
640640
for (let i = 0; i < outlets.length; i++) {
641641
const o = outlets[i] as HTMLSlotElement
@@ -663,6 +663,19 @@ export class VueElement
663663
}
664664
}
665665

666+
/**
667+
* @internal
668+
*/
669+
private _getSlots(): HTMLSlotElement[] {
670+
const roots: HTMLElement[] = [this]
671+
if (this._teleportTargets) {
672+
roots.push(...this._teleportTargets)
673+
}
674+
return roots.reduce<HTMLSlotElement[]>((res, i) => {
675+
res.push(...Array.from(i.querySelectorAll('slot')))
676+
return res
677+
}, [])
678+
}
666679
/**
667680
* @internal
668681
*/
@@ -716,11 +729,3 @@ export function useShadowRoot(): ShadowRoot | null {
716729
const el = __DEV__ ? useHost('useShadowRoot') : useHost()
717730
return el && el.shadowRoot
718731
}
719-
720-
function getSlots(roots: HTMLElement[] | undefined): HTMLSlotElement[] {
721-
if (!roots) return []
722-
return roots.reduce<HTMLSlotElement[]>((res, i) => {
723-
res.push(...Array.from(i.querySelectorAll('slot')))
724-
return res
725-
}, [])
726-
}

0 commit comments

Comments
 (0)