-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Description
Vue version
3.3.4
Link to minimal reproduction
https://github.com/Sidnioulz/vue-sfcmod/blob/feat/template/src/template/__tests__/stringify.spec.ts
Steps to reproduce
- Use
compileTemplate
to compile with the following pattern:<Transition><!-- Comment --><input /></Transition>
- Explore the AST
- Notice the absence of a children node for the comment
What is expected?
There should be a node in the children with type 3 / COMMENT, which contains the comment.
What is actually happening?
It seems that when the element node is a Vue transition, specifically, comment nodes are missing. TransitionGroup works fine, though.
System Info
No response
Any additional comments?
I'm writing a codemod engine for Vue templates and this issue prevents me from preserving comments in templates.
For repro, I have a unit test suite with a test named 'Comment inside transition'. It may have been merged to main by the time you read this, though.
Relevant code in core: https://github.com/vuejs/core/blob/main/packages/compiler-dom/__tests__/transforms/Transition.spec.ts#L150. This is intentional, though I don't understand what the harm is in preserving comments.