Skip to content

Commit

Permalink
use calculateSelectorNode for calculating specificity
Browse files Browse the repository at this point in the history
  • Loading branch information
Bart Veneman committed Aug 9, 2024
1 parent b78077d commit 146d48f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
15 changes: 8 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"code"
],
"dependencies": {
"@bramus/specificity": "^2.3.0",
"@bramus/specificity": "github:bartveneman/specificity#be1f89dea482a366b9ed5bd49ef3e8af4d9ccb34",
"css-tree": "^2.3.1"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import parse from 'css-tree/parser'
import walk from 'css-tree/walker'
import { calculate } from '@bramus/specificity/core'
import { calculateSelectorNode } from '@bramus/specificity/core'
import { isSupportsBrowserhack, isMediaBrowserhack } from './atrules/atrules.js'
import { getCombinators, getComplexity, isAccessibility, isPrefixed } from './selectors/utils.js'
import { colorFunctions, colorKeywords, namedColors, systemColors } from './values/colors.js'
Expand Down Expand Up @@ -318,7 +318,7 @@ export function analyze(css, options = {}) {
uniqueSelectorComplexities.p(complexity, node.loc)

// #region specificity
let [{ value: specificityObj }] = calculate(node)
let specificityObj = calculateSelectorNode(node)
let sa = specificityObj.a
let sb = specificityObj.b
let sc = specificityObj.c
Expand Down

0 comments on commit 146d48f

Please sign in to comment.