Skip to content

Commit

Permalink
Fix perserveComments on ssr (#4730)
Browse files Browse the repository at this point in the history
  • Loading branch information
confraria committed Apr 27, 2020
1 parent e3fef0f commit 06a8668
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 4 additions & 6 deletions src/compiler/compile/render_ssr/handlers/Comment.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import Renderer, { RenderOptions } from '../Renderer';
import Comment from '../../nodes/Comment';

export default function(_node: Comment, _renderer: Renderer, _options: RenderOptions) {
// TODO preserve comments

// if (options.preserveComments) {
// renderer.append(`<!--${node.data}-->`);
// }
export default function(node: Comment, renderer: Renderer, options: RenderOptions) {
if (options.preserveComments) {
renderer.add_string(`<!--${node.data}-->`);
}
}
4 changes: 2 additions & 2 deletions test/js/samples/ssr-preserve-comments/expected.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { create_ssr_component } from "svelte/internal";

const Component = create_ssr_component(($$result, $$props, $$bindings, $$slots) => {
return `<div>content</div>
<!-- comment -->
<div>more content</div>`;
});

export default Component;
export default Component;

0 comments on commit 06a8668

Please sign in to comment.