Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
astro-wt
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
9b920fd6
authored
2024-07-12 14:46:42 -0500
by
Adam Heath
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Reduce the debug.
1 parent
8a43a10d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
lib/html.ts
lib/html.ts
View file @
9b920fd
...
...
@@ -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'
)
...
...
Please
register
or
sign in
to post a comment