@@ -238,12 +238,22 @@ class Negation(object):
238
238
Represents selector:not(subselector)
239
239
"""
240
240
241
- def __init__ (self , selector , subselector ):
241
+ def __init__ (self , selector , subselector , combinator = None , subselector2 = None ):
242
242
self .selector = selector
243
243
self .subselector = subselector
244
+ self .combinator = combinator
245
+ self .subselector2 = subselector2
244
246
245
247
def __repr__ (self ):
246
- return "%s[%r:not(%r)]" % (self .__class__ .__name__ , self .selector , self .subselector )
248
+ if self .combinator is None and self .subselector2 is None :
249
+ return "%s[%r:not(%r)]" % (self .__class__ .__name__ , self .selector , self .subselector )
250
+ return "%s[%r:not(%r %s %r)]" % (
251
+ self .__class__ .__name__ ,
252
+ self .selector ,
253
+ self .subselector ,
254
+ self .combinator .value ,
255
+ self .subselector2 .parsed_tree ,
256
+ )
247
257
248
258
def canonical (self ):
249
259
subsel = self .subselector .canonical ()
@@ -614,9 +624,11 @@ def parse_simple_selector(stream, inside_negation=False):
614
624
"Got pseudo-element ::%s inside :not() at %s"
615
625
% (argument_pseudo_element , next .pos )
616
626
)
627
+ combinator = arguments = None
617
628
if next != ("DELIM" , ")" ):
618
- raise SelectorSyntaxError ("Expected ')', got %s" % (next ,))
619
- result = Negation (result , argument )
629
+ stream .skip_whitespace ()
630
+ combinator , arguments = parse_relative_selector (stream )
631
+ result = Negation (result , argument , combinator , arguments )
620
632
elif ident .lower () == "has" :
621
633
combinator , arguments = parse_relative_selector (stream )
622
634
result = Relation (result , combinator , arguments )
0 commit comments