Handle inner not conditions from root

This commit is contained in:
ItsDrike 2025-07-27 17:19:56 +02:00
parent 25c98b6e42
commit 0545673e61
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0

View file

@ -111,7 +111,14 @@ def visit_not_pseudo_class_selector(
context = (subnode for node in context for subnode in walk_nodes(node))
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)
yield node