9b920fd6 by Adam Heath

Reduce the debug.

1 parent 8a43a10d
......@@ -48,7 +48,6 @@ const compileMatcher = (ast: AST, selector: string): MatcherProducer => {
neededContext[ selectorCacheCounter ] = () => new WeakMap()
const findChildren = (context, parent?: NodeType, selector: string, matcher: Matcher): array[NodeType] => {
if (parent === null) console.log('null parent', new Error())
if (parent === null) return []
let selectorCache = context[ selectorCacheCounter ].get(parent)
if (!selectorCache) context[ selectorCacheCounter ].set(parent, selectorCache = {})
......@@ -242,7 +241,7 @@ const compileMatcher = (ast: AST, selector: string): MatcherProducer => {
// case 'nth-last-of-type':
// case 'nth-last-child':
case 'nth-child': {
console.log('nth-child:ast', ast)
//console.log('nth-child:ast', ast)
const argument = ast.subtree ? ast.argument.replace(/\s*of\s+.*$/, '') : ast.argument
const nthChildMatcher = makeNthChildPosMatcher(argument)
let subDebug, childSelector, childMatcher
......@@ -260,7 +259,7 @@ const compileMatcher = (ast: AST, selector: string): MatcherProducer => {
const children = findChildren(context, parent, childSelector, childMatcher)
const pos = children.indexOf(node)
if (parent?.name === 'body' && pos !== -1) {
console.log('nth-child:debug', {parent, childSelector, children, node, pos})
//console.log('nth-child:debug', {parent, childSelector, children, node, pos})
}
if (pos === -1) return false
return nthChildMatcher(context, node, parent, pos + 1, debug || parent?.name === 'body')
......