vuejs / core

🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
https://vuejs.org/
MIT License
47.75k stars 8.35k forks source link

Native scope style element in template can cause compiler error #12456

Open lejunyang opened 23 hours ago

lejunyang commented 23 hours ago

Vue version

3.5.13

Link to minimal reproduction

https://play.vuejs.org/#eNp9kT9PwzAQxb+K5blqBpiqUPFHHWAAVDp6iZIjuLhny3cpRVW+O2dbKR2gk3333rN+dz7quxDm+wH0QtfURhtYEfAQlgYN1lVplYJhF1zDIJVSdWf3+SLX1u+CR0BWlm6MJv52YPTyllofQB0VhQblaL3zcaH6CIBqVGNdnYLTSzn6XzBCV2LFNUXEs1yLtIEDi5bKDFgVwro649YzzfI4vtt+viWPMvUxmY1OKNZBfAlsPZLRC5WVpDXO+a+n3OM4wGzqtx/Qfv7R39Ih9Yx+jUAQ97KMk8ZN7IGLvHp7FuYzcee7Ia3ugrgG8m5IjMV2P2An2Ge+TPsoi41ssd/Q6sCANA2VQJNzzH6j5esfLoz+i3s1v845g6MefwDExbv6

Steps to reproduce

image

What is expected?

CSS Scope allows style element like <style>@scope {}</style> exist in normal HTML elements and apply scoped style on parent element, details can be found in MDN Though this is quite a new feature, and we can use component to avoid compiler detection I am not sure if we should have an option to allow style element exist in template.

What is actually happening?

style element can cause compiler error and the style node is removed

System Info

No response

Any additional comments?

No response