Skip to content

Commit

Permalink
fix: do not force slots to be self-closed (#435)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmajor authored Apr 12, 2024
1 parent 601ee41 commit 539169b
Show file tree
Hide file tree
Showing 3 changed files with 7 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>
4 changes: 4 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,10 @@

<MyComponent />

<!-- TODO: self-closing slot shouldn't be allowed in the next major version -->
<slot />
<slot></slot>

<img />

<input />
Expand Down

0 comments on commit 539169b

Please sign in to comment.