Skip to content
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

Vue breaks Declarative Shadow DOM #12813

Open
LeaVerou opened this issue Feb 6, 2025 · 0 comments
Open

Vue breaks Declarative Shadow DOM #12813

LeaVerou opened this issue Feb 6, 2025 · 0 comments
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage.

Comments

@LeaVerou
Copy link

LeaVerou commented Feb 6, 2025

Vue version

3

Link to minimal reproduction

https://codepen.io/leaverou/pen/wBwLmKv

Steps to reproduce

The testcase contains two otherwise identical elements. One is left as-is, and the other is initialized as a Vue app that does nothing.

What is expected?

Both elements should display "Shadow content"

What is actually happening?

The Vue app element has lost its shadow DOM and is now displaying "Light content"

System Info

Any additional comments?

This is happening because the shadow root is not visible when elements are serialized (e.g. via outerHTML, innerHTML and the like). The only way to find out that it exists is to check the element’s shadowRoot property, which requires a full traversal (though that might be okay as it’s a one-time cost?). If a full traversal is out of the question, perhaps a solution could be to provide an attribute developers can use to mark these elements. And obviously closed shadow roots are beyond saving.

@edison1105 edison1105 added the 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. label Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage.
Projects
None yet
Development

No branches or pull requests

2 participants