-
-
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
Annotations have an impact on the length of the slot #9655
Comments
This problem does not occur in production mode, because Vue compiler will delete comment nodes in production mode. |
Comment nodes are allowed as valid child elements. Although they don't affect the rendering of the component's default slot, they might lead to confusion when users check for the presence of the default slot using the The issue with inconsistent results in core/packages/compiler-core/src/transforms/vSlot.ts Lines 323 to 344 in 1c525f7
Deciding on changes to how comment nodes are handled in slots, requires further discussion and work. If you need to check whether there is actual content rendered in the default slot using
<script setup>
import { useSlots, Comment } from 'vue';
const foo = useSlots()
.default()
.filter((i) => i.type !== Comment);
</script> Hope this helps. |
Weird, not to be exaggerated things, but I need to filter them out |
Vue version
3.3.8
Link to minimal reproduction
https://play.vuejs.org/#eNqNUs1OwzAMfpUQDmzS1qrbTlOpBGgHOABiHHOpWq/tSJMqScekqu+Ok7brEAxx8/cT27Hd0Luq8g410DUNdaKKyhANpq4iJoqyksqQB1lWZKdkSW483wJrv2Ei9Ds/OhEYKCseG0BESGhtLsI4DyILg9DHqOeu5vMwX0RBYNlFRObzQRnykOs4jnsS6bQ4RKvVKvRt0Fv97zVdbxfLL/5R/pTiLDWdUaMTKXZF5u21FDinxnoZTdBbcFAvlSmk0IyuiVOsFnMuP58cZ1QNs4FPckg+fuH3+mg5Rl8VaFAHYPSkmVhlYDp5s32GI8YnsZRpzdH9h/gGWvLa9tjZ7muRYttnPtfto9t2IbJ3vTkaEHr4lG3UOlvnZxS3b8d06etju0tv6d4x0eIUh8v5eWiKCRywRsylIbckhV0hYItAT6ZWHS8NgSPGzSPqz6MLu403jUvmYaq45mYy9TiIzOSkbbs76J511+QqjAtvvwCppvub
Steps to reproduce
run
What is expected?
The value of Comp2 should be 1
What is actually happening?
The value of Comp2 is 2
System Info
No response
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: