Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9dcf7c0

Browse files
committedJun 4, 2024··
Improve how whitespace is consumed in complex selectors
1 parent eb3e2a7 commit 9dcf7c0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed
 

‎lib/syntax_tree/css/selectors.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,14 @@ def complex_selector
334334
child_nodes = [compound_selector]
335335

336336
loop do
337+
maybe { consume_whitespace }
338+
337339
if (c = maybe { combinator })
338340
child_nodes << c
341+
342+
maybe { consume_whitespace }
339343
end
344+
340345
if (s = maybe { compound_selector })
341346
child_nodes << s
342347
else
@@ -363,8 +368,6 @@ def relative_selector
363368
# <compound-selector> = [ <type-selector>? <subclass-selector>*
364369
# [ <pseudo-element-selector> <pseudo-class-selector>* ]* ]!
365370
def compound_selector
366-
consume_whitespace
367-
368371
type = maybe { type_selector }
369372
subclasses = []
370373

@@ -401,8 +404,6 @@ def simple_selector
401404

402405
# <combinator> = '>' | '+' | '~' | [ '|' '|' ]
403406
def combinator
404-
consume_whitespace
405-
406407
value =
407408
options do
408409
maybe { consume(">") } ||

0 commit comments

Comments
 (0)
Please sign in to comment.