Skip to content

Commit

Permalink
do not force slots to be self-closed
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmajor committed Apr 11, 2024
1 parent 601ee41 commit 4bc3543
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/print/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,10 @@ export function print(path: FastPath, options: ParserOptions, print: PrintFn): D
((((node.type === 'Element' && !options.svelteStrictMode) ||
node.type === 'Head' ||
node.type === 'InlineComponent' ||
node.type === 'Slot' ||
node.type === 'SlotTemplate' ||
node.type === 'Title') &&
didSelfClose) ||
node.type === 'Slot' ||
node.type === 'Window' ||
selfClosingTags.indexOf(node.name) !== -1 ||
isDoctypeTag);
Expand Down
2 changes: 2 additions & 0 deletions test/printer/samples/self-closing-tags-lenient.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<slot />
<slot></slot>
2 changes: 2 additions & 0 deletions test/printer/samples/self-closing-tags.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

<MyComponent />

<slot></slot>

<img />

<input />
Expand Down

0 comments on commit 4bc3543

Please sign in to comment.