fix validation for global compound selector (#8344)

pull/8347/head
Tan Li Hau 1 year ago committed by GitHub
parent fbaf3cfc12
commit d525901556
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

@ -0,0 +1,12 @@
[{
"code": "css-invalid-global-selector-position",
"message": ":global(...) not at the start of a selector sequence should not contain type or universal selectors",
"start": {
"line": 2,
"column": 5
},
"end": {
"line": 2,
"column": 21
}
}]

@ -0,0 +1,7 @@
<style>
.foo:global(div.bar) {
color: red;
}
</style>
<div class="foo" />
Loading…
Cancel
Save