From 4bc3543733fc646fa85e5b06f5e566bfc868263f Mon Sep 17 00:00:00 2001 From: Jeremiasz Major Date: Thu, 11 Apr 2024 22:13:05 +0200 Subject: [PATCH] do not force slots to be self-closed --- src/print/index.ts | 2 +- test/printer/samples/self-closing-tags-lenient.html | 2 ++ test/printer/samples/self-closing-tags.html | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 test/printer/samples/self-closing-tags-lenient.html diff --git a/src/print/index.ts b/src/print/index.ts index f525b396..44ad01f1 100644 --- a/src/print/index.ts +++ b/src/print/index.ts @@ -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); diff --git a/test/printer/samples/self-closing-tags-lenient.html b/test/printer/samples/self-closing-tags-lenient.html new file mode 100644 index 00000000..23ef5f14 --- /dev/null +++ b/test/printer/samples/self-closing-tags-lenient.html @@ -0,0 +1,2 @@ + + diff --git a/test/printer/samples/self-closing-tags.html b/test/printer/samples/self-closing-tags.html index 662774ba..aa8e0491 100644 --- a/test/printer/samples/self-closing-tags.html +++ b/test/printer/samples/self-closing-tags.html @@ -6,6 +6,8 @@ + +