@@ -373,36 +373,33 @@ def parse_simple_selector(stream, inside_negation=False):
373
373
# Any new pseudo-element must have two.
374
374
pseudo_element = ident
375
375
continue
376
- if stream .peek () == '(' :
377
- stream .next ()
378
- stream .skip_whitespace ()
379
- is_negation = ident .lower () == 'not'
380
- if is_negation :
381
- if inside_negation :
382
- raise SelectorSyntaxError ('Got nested :not()' )
383
- argument , argument_pseudo_element = parse_simple_selector (
384
- stream , inside_negation = True )
385
- if argument_pseudo_element :
386
- raise SelectorSyntaxError (
387
- 'Pseudo-elements are not allowed inside :not()' )
388
- else :
389
- peek = stream .peek ()
390
- if isinstance (peek , (Symbol , String )):
391
- argument = stream .next ()
392
- else :
393
- raise SelectorSyntaxError (
394
- "Expected argument, got '%s'" % peek )
395
- stream .skip_whitespace ()
396
- next = stream .next ()
397
- if not next == ')' :
376
+ if stream .peek () != '(' :
377
+ result = Pseudo (result , ident )
378
+ continue
379
+ stream .next ()
380
+ stream .skip_whitespace ()
381
+ if ident .lower () == 'not' :
382
+ if inside_negation :
383
+ raise SelectorSyntaxError ('Got nested :not()' )
384
+ argument , argument_pseudo_element = parse_simple_selector (
385
+ stream , inside_negation = True )
386
+ if argument_pseudo_element :
398
387
raise SelectorSyntaxError (
399
- "Expected ')', got '%s'" % next )
400
- if is_negation :
401
- result = Negation (result , argument )
402
- else :
403
- result = Function (result , ident , argument )
388
+ 'Pseudo-elements are not allowed inside :not()' )
389
+ result = Negation (result , argument )
404
390
else :
405
- result = Pseudo (result , ident )
391
+ peek = stream .peek ()
392
+ if isinstance (peek , (Symbol , String )):
393
+ argument = stream .next ()
394
+ else :
395
+ raise SelectorSyntaxError (
396
+ "Expected argument, got '%s'" % peek )
397
+ result = Function (result , ident , argument )
398
+ stream .skip_whitespace ()
399
+ next = stream .next ()
400
+ if not next == ')' :
401
+ raise SelectorSyntaxError (
402
+ "Expected ')', got '%s'" % next )
406
403
continue
407
404
else :
408
405
raise SelectorSyntaxError (
0 commit comments