Nested directive-less `<template>` doesn't render
Vue version
3.2.47
Link to minimal reproduction
Steps to reproduce
<template>
Hello world!
<template>
<!-- Doesn't render --> Goodbye world!
</template>
</template>
What is expected?
For "Goodbye world!" to render.
Works in Vue 2: https://jsfiddle.net/otfqp5ey/
What is actually happening?
Doesn't render.
System Info
No response
Any additional comments?
I'm not actually trying to use <template>string</template>
. But during development, I wrote that markup to see how the text looks to see whether I need to use a span[class=""]
before adding a v-if
, and was confused why it wasn't rendering.
Aside from that, I could see benefits for a directive-less <template>
for organizational purposes.
It’s by design in Vue 3: https://vuejs.org/api/built-in-special-elements.html#template
Allowing a way to use native <template>
makes sense and is cool, but the DX is quite unintuitive. I think most users would assume <template>
to be a special Vue.js element.
Are there real use-cases for native <template>
in Vue.js? Seems like there wouldn't/shouldn't be, given a major point of adopting Vue.js is to organize reusable templates into components.
Anyway, I think this is closable given changing this behavior would be breaking and is unlikely to happen.