Skip to content

Discrepancy in parent resolving for vue custom element and vue component #12479

Open
@lejunyang

Description

@lejunyang

Vue version

3.5.13

Link to minimal reproduction

https://play.vuejs.org/#eNqdVMFu2zAM/RVNFydAlhy2U5Z2WINg2A5bsA07+WLYTKpUlgRJ9lIY/vdRkuMKrusGvUnkE/n4SKqhX5Ra1hXQNd2YXDNliQFbqdtUsFJJbclXnYlin2kQlhy0LEmyXEU29zj51KMHwFHM9p7xoof42wDRkAIOTMC2MlaWOw6lC9p2bzosog9k9i6PMWZ5BDtLysf3R0cxmc/JwB8CR5DFWK5ZVOF8Pp1JedR0qg4znuu6NLnTaTpLgIwn8TK7HKnYrEKnscd4sVAqnlnAGyGbgtW3fyvYrNzBWyIlvAFNoYGr4I+HwUfsomx3UZCL2iQPeYLJ8+3jXDB43awiVnRBrcmlOLDj8mSkwFFt3IuU5rJUjIP+qSyTwqR0TbzH+TLO5b/v3mZ1BYuLPb+H/GHEfjJnZ0vpXoMBXUNKe5/NNHYhuHe/f8AZz72zlEXFET3h/AVG8spxDLC7ShRIO8J5tt/88DNx/GN2ZwvCXIpyRB2y9fiU4gJsJ0p/ovth+dG/S0WLKj4t48vb3hClZc0KeL5tnWOWPMAjDlkSwiU4Uq8NVNdxw6Xtux3sw0YPPpY38LzmH0oFjpOxLoQy5Kbbl727zbyKOazJnZQcMsS2WOGw9ojnawK4IZXCkVkzc4MDCOQzif4Esu7IpnRUqP79iFz93zklFBMnyEd+z6BBnfEKUIOACgVe3dKwwD4Ezl/TBWtx3l5qcfsfbOQ2YA==

Steps to reproduce

We can see from the inject texts:
image

In vue component, Child component's parent is "Parent', its actual slotted parent
but in custom element, Child component's parent is "GrandParent"

What is expected?

should have same behavior

What is actually happening?

For now in custom element, parent resolving is done by iterating parentNode and host, we should check assignedSlot first to get actual slotted parent in actual render tree order

System Info

No response

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.scope: custom elements

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions