File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,7 +33,10 @@ async function cloneChildren<T extends HTMLElement>(
3333 clonedNode : T ,
3434 options : Options ,
3535) : Promise < T > {
36- const children = toArray < T > ( ( nativeNode . shadowRoot ?? nativeNode ) . childNodes )
36+ const children =
37+ isSlotElement ( nativeNode ) && nativeNode . assignedNodes
38+ ? toArray < T > ( nativeNode . assignedNodes ( ) )
39+ : toArray < T > ( ( nativeNode . shadowRoot ?? nativeNode ) . childNodes )
3740
3841 if ( children . length === 0 ) {
3942 return Promise . resolve ( clonedNode )
@@ -114,3 +117,6 @@ export async function cloneNode<T extends HTMLElement>(
114117 . then ( ( clonedNode ) => cloneChildren ( nativeNode , clonedNode , options ) )
115118 . then ( ( clonedNode ) => decorate ( nativeNode , clonedNode ) )
116119}
120+
121+ const isSlotElement = ( node : Element ) : node is HTMLSlotElement =>
122+ node . tagName === 'SLOT'
You can’t perform that action at this time.
0 commit comments