File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
lib/styles/parser/selector Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -311,7 +311,13 @@ export class CSSSelectorParser {
311
311
const beforeTrivials = / ^ \( \s * / u. exec ( source ) ;
312
312
if ( ! beforeTrivials ?. [ 0 ] ) return ;
313
313
let withinParen = false ;
314
- for ( let index = end - 1 ; index < code . length ; index ++ ) {
314
+
315
+ for (
316
+ // Search from `end - 1` since it may be in the current source.
317
+ let index = end - 1 ;
318
+ index < code . length ;
319
+ index ++
320
+ ) {
315
321
const ch = code [ index ] ;
316
322
if ( ch === ")" ) {
317
323
withinParen = true ;
@@ -336,12 +342,12 @@ export class CSSSelectorParser {
336
342
const afterTrivials = / \s * \) $ / u. exec ( source ) ;
337
343
if ( ! afterTrivials ?. [ 0 ] ) return ;
338
344
let withinParen = false ;
339
- for ( let index = start ; index >= 0 ; index -- ) {
345
+ for ( let index = start - 1 ; index >= 0 ; index -- ) {
340
346
const ch = code [ index ] ;
341
347
if ( ch === "(" ) {
342
348
withinParen = true ;
343
349
break ;
344
- } else if ( ch ?. trim ( ) && index !== start ) {
350
+ } else if ( ch ?. trim ( ) ) {
345
351
return ;
346
352
}
347
353
}
You can’t perform that action at this time.
0 commit comments