@@ -55,7 +55,7 @@ export function parseSelector(selector: string, customNames: Set<string>): Parse
55
55
}
56
56
57
57
const chain = ( from : number , to : number ) : CSSComplexSelector => {
58
- let result : CSSComplexSelector = { simples : [ ] } ;
58
+ const result : CSSComplexSelector = { simples : [ ] } ;
59
59
for ( const part of v1 . parts . slice ( from , to ) ) {
60
60
let name = part . name ;
61
61
let wrapInLight = false ;
@@ -70,24 +70,14 @@ export function parseSelector(selector: string, customNames: Set<string>): Parse
70
70
simple = callWith ( 'is' , parsed . selector ) ;
71
71
} else if ( name === 'text' ) {
72
72
simple = textSelectorToSimple ( part . body ) ;
73
+ if ( result . simples . length )
74
+ result . simples [ result . simples . length - 1 ] . combinator = '>=' ;
73
75
} else {
74
76
simple = callWith ( name , [ part . body ] ) ;
75
77
}
76
78
if ( wrapInLight )
77
79
simple = callWith ( 'light' , [ simpleToComplex ( simple ) ] ) ;
78
- if ( name === 'text' ) {
79
- const copy = result . simples . map ( one => {
80
- return { selector : copySimple ( one . selector ) , combinator : one . combinator } ;
81
- } ) ;
82
- copy . push ( { selector : simple , combinator : '' } ) ;
83
- if ( ! result . simples . length )
84
- result . simples . push ( { selector : callWith ( 'scope' , [ ] ) , combinator : '' } ) ;
85
- const last = result . simples [ result . simples . length - 1 ] ;
86
- last . selector . functions . push ( { name : 'is' , args : [ simpleToComplex ( simple ) ] } ) ;
87
- result = simpleToComplex ( callWith ( 'is' , [ { simples : copy } , result ] ) ) ;
88
- } else {
89
- result . simples . push ( { selector : simple , combinator : '' } ) ;
90
- }
80
+ result . simples . push ( { selector : simple , combinator : '' } ) ;
91
81
}
92
82
return result ;
93
83
} ;
@@ -110,10 +100,6 @@ function simpleToComplex(simple: CSSSimpleSelector): CSSComplexSelector {
110
100
return { simples : [ { selector : simple , combinator : '' } ] } ;
111
101
}
112
102
113
- function copySimple ( simple : CSSSimpleSelector ) : CSSSimpleSelector {
114
- return { css : simple . css , functions : simple . functions . slice ( ) } ;
115
- }
116
-
117
103
function textSelectorToSimple ( selector : string ) : CSSSimpleSelector {
118
104
function unescape ( s : string ) : string {
119
105
if ( ! s . includes ( '\\' ) )
0 commit comments