Skip to content

Detached elements are generated under certain circumstances #13661

@sakura-flutter

Description

@sakura-flutter

Vue version

3.5.17

Link to minimal reproduction

https://play.vuejs.org/#__PROD__eNp9Ustu4zAM/BWtLk2Aro1m95R1gn2gh93Dtmh71MV16FStLBl6uAEM/3tJyXFc9HGyzBmSwyF7/qttsy4AX/PCQ9Oq0sNWaMaK++C90exnpWT1tBG8k07eK2Ab9mV8Cr4dX+u+Z0d8GIo85WKdWOmPadoL1n2V9akM5hKG6E5243Okrlh+ChB6UeRz0mpMnIJFHjvgu8hnM+Cvq6xsPXPgQ8tUqfcowLvYWzatsZ71zELNBlZb0zBUF1DZjwlNyiN2lqUuZNbZK8LqFWE1EoSujHZ+smVDjRbeBlhifaFR051swAS/WCzZZst6GmVkZ12pAuXUpXIg9LCk2dI0qJ2f4xRYvpb77NEZjcuL2YJXqEAqsFetl9he8HWqS1iplHn+F2Mk4/wYrx6genon/ugOFBP82oID26EzE+ZLuwef4Mvb/3DA9wQ2Zhdow5+AN+CMCqQx0X4HvUPZM15U+ze6LPX+zl0ePGh3HIqEEnOI/Lg3Mv+j0U9yv2XfYx56ii5OG317/g90T/HOnDJ+i+7TJ51bxGa3NlaKq3+nUjroOX94AStBIck=

Steps to reproduce

  1. Open DevTools and navigate to the "Memory" tab.
  2. Check for detached element h1.

What is expected?

Detached h1 shouldn't show up in the memory profile.

What is actually happening?

Detached h1 shows up in the memory profile.

System Info

Win11 Chrome 138.0.7204.158

Any additional comments?

Strangely, if I remove some content in the slot, the problem disappears (Playground). I'm not sure if this is a bug or intentional behavior.

From previous issues, I learned that adding this configuration solves the problem:

plugins: [vue({ template: { compilerOptions: { hoistStatic: false } } })]

If this is not a bug, could you please consider adding the hoistStatic option to the Playground? This would greatly help with troubleshooting, as the current behavior makes issue diagnosis more difficult.

Thanks for your time and attention!

Metadata

Metadata

Assignees

No one assigned

    Labels

    ❗ p4-importantPriority 4: this fixes bugs that violate documented behavior, or significantly improves perf.scope: compiler

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions