Handle inner not conditions from root
This commit is contained in:
parent
25c98b6e42
commit
0545673e61
1 changed files with 8 additions and 1 deletions
|
@ -111,7 +111,14 @@ def visit_not_pseudo_class_selector(
|
||||||
context = (subnode for node in context for subnode in walk_nodes(node))
|
context = (subnode for node in context for subnode in walk_nodes(node))
|
||||||
|
|
||||||
for node in context:
|
for node in context:
|
||||||
if any(visit(selector.not_selector, [node], recurse=False)):
|
root = node
|
||||||
|
while True:
|
||||||
|
if root.parent is None:
|
||||||
|
break
|
||||||
|
root = root.parent
|
||||||
|
|
||||||
|
root_not_matches = visit(selector.not_selector, [root], recurse=True)
|
||||||
|
if node in root_not_matches:
|
||||||
continue # exclude this node (not condition matched)
|
continue # exclude this node (not condition matched)
|
||||||
yield node
|
yield node
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue