-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTML comment breaks automatic attribute inheritance #5203
Labels
Comments
More info: Error message
App <template>
<HelloWorld class="red">Test</HelloWorld>
</template>
<script>
import HelloWorld from "./HelloWorld.vue";
export default {
name: "App",
components: {
HelloWorld,
},
};
</script>
<style>
.red {
color: red;
}
</style> Component <template>
<!-- comment A -->
<span v-if="false">
<slot />
</span>
<!-- comment B -->
<div v-else>
<slot />
</div>
</template> |
Putting a comment immediately under MyComponent.vue <template>
<!-- Root comment -->
<div>some content</div>
</template> Usage <Transition name="fade">
<MyComponent v-if="visible" />
</Transition> The transition enters correctly, but there is no transition on leave. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Version
3.2.26
Reproduction link
sfc.vuejs.org/
Steps to reproduce
See the minimal reproduction. As is, the class="red" attribute is not passed down to the component. Try removing "comment B" from the component, and it will work. Or, if you move it underneath/within the v-else, it will also work.
What is expected?
HTML comments in the template should have no affect on the underlying styles, behavior, CSS, JS, Vue, or anything.
What is actually happening?
An HTML comment, combined with v-if, is confusing vue's ability to automatically inherit attributes.
The text was updated successfully, but these errors were encountered: