From 0545673e6151bbd14cdbc7a705394b9911885182 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Sun, 27 Jul 2025 17:19:56 +0200 Subject: [PATCH] Handle inner not conditions from root --- src/visitor.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/visitor.py b/src/visitor.py index dbd965d..a32c8e1 100644 --- a/src/visitor.py +++ b/src/visitor.py @@ -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