File tree 4 files changed +22
-1
lines changed
src/compiler/compile/nodes
test/runtime/samples/slot-in-dynamic-element
4 files changed +22
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' svelte ' : patch
3
+ ---
4
+
5
+ fix: allow child element with slot attribute within svelte: element
Original file line number Diff line number Diff line change @@ -1413,7 +1413,9 @@ const regex_minus_sign = /-/;
1413
1413
function within_custom_element ( parent ) {
1414
1414
while ( parent ) {
1415
1415
if ( parent . type === 'InlineComponent' ) return false ;
1416
- if ( parent . type === 'Element' && regex_minus_sign . test ( parent . name ) ) return true ;
1416
+ if ( parent . type === 'Element' ) {
1417
+ if ( regex_minus_sign . test ( parent . name ) || parent . is_dynamic_element ) return true ;
1418
+ }
1417
1419
parent = parent . parent ;
1418
1420
}
1419
1421
return false ;
Original file line number Diff line number Diff line change
1
+ export default {
2
+ html : `
3
+ <dynamic-element>
4
+ <header slot='header'>header header header</header>
5
+ </dynamic-element>
6
+ `
7
+ } ;
Original file line number Diff line number Diff line change
1
+ <script >
2
+ export let tagName = ' dynamic-element'
3
+ </script >
4
+
5
+ <svelte:element this ={tagName }>
6
+ <header slot =' header' >header header header</header >
7
+ </svelte:element >
You can’t perform that action at this time.
0 commit comments