Skip to content

Commit fca6a6d

Browse files
authored
:global() with pseudo element should be considered as global (#6470)
1 parent 98ddf8b commit fca6a6d

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

src/compiler/compile/css/Selector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ class Block {
610610
this.selectors.length >= 1 &&
611611
this.selectors[0].type === 'PseudoClassSelector' &&
612612
this.selectors[0].name === 'global' &&
613-
this.selectors.every((selector) => selector.type === 'PseudoClassSelector')
613+
this.selectors.every((selector) => selector.type === 'PseudoClassSelector' || selector.type === 'PseudoElementSelector')
614614
);
615615
}
616616
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[{
2+
"code": "css-invalid-global",
3+
"message": ":global(...) can be at the start or end of a selector sequence, but not in the middle",
4+
"start": {
5+
"line": 5,
6+
"column": 6,
7+
"character": 60
8+
},
9+
"end": {
10+
"line": 5,
11+
"column": 19,
12+
"character": 73
13+
},
14+
"pos": 60
15+
}]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<style>
2+
.foo :global(.bar)::after {
3+
color: red;
4+
}
5+
.foo :global(.bar)::after .baz {
6+
color: red;
7+
}
8+
</style>

0 commit comments

Comments
 (0)