06a33897 by Adam Heath

Fix complex matching, don't always add the node to left, and fix ' '.

1 parent f277360d
......@@ -171,16 +171,9 @@ const compileMatcher = (ast: AST, selector: string): MatcherProducer => {
leftMatches.add(node)
}
if (!rightMatcher(context, node, parent, i, debug)) return false
leftMatches.add(node)
if (debug) console.log('matched on right', { left, right, combinator, pos, node, parent })
switch (combinator) {
case ' ':
let parentPtr = parent
while (parentPtr) {
if (leftMatches.has(parentPtr)) return true
parentPtr = parentPtr.parent
}
return false
case '>':
if (debug) console.log('leftMatches parent', leftMatches.has(parent))
return parent ? leftMatches.has(parent) : false
......