Skip to content

Conversation

@esthedebeste
Copy link
Contributor

@esthedebeste esthedebeste commented Jan 24, 2022

When the option preserveComments is given in a DOM render context, it'll add Comment nodes.

Also added tests.

Tests

  • Run the tests with npm test and lint the project with npm run lint

Multiple comments are separated by --><!--, so prefix matching isn't required.
@dummdidumm
Copy link
Member

If we add this, it probably should be through enhancing the option to make it backwards compatible - e.g. an enum like "ssr" | "dom" | "both"

@benmccann benmccann changed the title [feat] Make preserveComments effective in DOM renderer feat: make preserveComments effective in DOM renderer Mar 14, 2023
@Rich-Harris
Copy link
Member

I think an enum would probably be weird, given that you're providing this option alongside generate: 'dom' | 'ssr'. We should either merge this on the basis that it's not really a breaking change (no user-observable behaviour would change, it would just enable whatever use case motivated this change in the first place), or include it in v4

Copy link
Member

@dummdidumm dummdidumm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point regarding the enum - I'll merge this then

@dummdidumm dummdidumm merged commit 95c4655 into sveltejs:master Mar 27, 2023
@Conduitry
Copy link
Member

This has been released in 3.58.0 - thank you!

@esthedebeste esthedebeste deleted the dom-comments branch March 31, 2023 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants