Skip to content

Commit e053ef0

Browse files
committed
convert some simple selector counting
1 parent fb05091 commit e053ef0

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,8 @@ function analyzeInternal<T extends boolean>(css: string, options: Options, useLo
341341
uniqueRuleNesting.p(depth, loc)
342342
} else if (node.type_name === 'Selector') {
343343
selectorNesting.push(depth > 0 ? depth - 1 : 0)
344+
uniqueSelectorNesting.p(depth > 0 ? depth - 1 : 0, wallaceLoc(node))
345+
uniqueSelectors.add(node.text)
344346
} else if (node.type_name === 'Declaration') {
345347
totalDeclarations++
346348
uniqueDeclarations.add(node.text)
@@ -468,11 +470,8 @@ function analyzeInternal<T extends boolean>(css: string, options: Options, useLo
468470
prefixedSelectors.p(selector, loc)
469471
}
470472

471-
uniqueSelectors.add(selector)
472473
selectorComplexities.push(complexity)
473474
uniqueSelectorComplexities.p(complexity, loc)
474-
// selectorNesting now tracked by Wallace parser
475-
uniqueSelectorNesting.p(nestingDepth - 1, loc)
476475

477476
// #region specificity
478477
let specificity: Specificity = calculateForAST(node).toArray()

0 commit comments

Comments
 (0)