fix: support attribute selector inside :global() (#11135)

* fix: support attribute selector inside :global()

* Update Selector.js
pull/11202/head
Tan Li Hau 9 months ago committed by GitHub
parent ad00cad761
commit a510c6a37f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
support attribute selector inside :global()

@ -214,7 +214,7 @@ export default class Selector {
index !== 0 &&
selector.children &&
selector.children.length > 0 &&
!/[.:#\s]/.test(selector.children[0].value[0])
!/[.:#[\s]/.test(selector.children[0].value[0])
) {
component.error(selector, compiler_errors.css_invalid_global_selector_position);
}

@ -0,0 +1 @@
.anim-checkbox.svelte-xyz[data-state='checked']{background-color:red}

@ -0,0 +1,6 @@
<style>
.anim-checkbox:global([data-state='checked']) {
background-color: red;
}
</style>
<div class="anim-checkbox"></div>

@ -0,0 +1,6 @@
<style>
.anim-checkbox:global([data-state='checked']) {
background-color: red;
}
</style>
<div class="anim-checkbox"></div>
Loading…
Cancel
Save