Skip to content

Commit 6ada112

Browse files
committed
use wallaces node.is_vendor_prefixed more
1 parent de9b755 commit 6ada112

3 files changed

Lines changed: 17 additions & 4 deletions

File tree

‎src/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ function analyzeInternal<T extends boolean>(css: string, options: Options, useLo
282282
let prelude = `@${name} ${node.prelude.text}`
283283
keyframes.p(prelude, toLoc(node))
284284

285-
if (is_vendor_prefixed(name)) {
285+
if (node.is_vendor_prefixed) {
286286
prefixedKeyframes.p(prelude, toLoc(node))
287287
complexity++
288288
}

‎src/selectors/utils.ts‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
import { KeywordSet } from '../keyword-set.js'
2-
import { type CSSNode, is_vendor_prefixed, SKIP, BREAK, walk, PSEUDO_ELEMENT_SELECTOR, PSEUDO_CLASS_SELECTOR, TYPE_SELECTOR, ATTRIBUTE_SELECTOR, SELECTOR, COMBINATOR, NTH } from '@projectwallace/css-parser'
2+
import {
3+
type CSSNode,
4+
is_vendor_prefixed,
5+
SKIP,
6+
BREAK,
7+
walk,
8+
PSEUDO_ELEMENT_SELECTOR,
9+
PSEUDO_CLASS_SELECTOR,
10+
TYPE_SELECTOR,
11+
ATTRIBUTE_SELECTOR,
12+
SELECTOR,
13+
COMBINATOR,
14+
NTH,
15+
} from '@projectwallace/css-parser'
316

417
const PSEUDO_FUNCTIONS = new KeywordSet(['nth-child', 'where', 'not', 'is', 'has', 'nth-last-child', 'matches', '-webkit-any', '-moz-any'])
518

@@ -107,8 +120,7 @@ export function getComplexity(selector: CSSNode): number {
107120

108121
// Check for vendor-prefixed pseudo-elements, type selectors, and pseudo-classes
109122
if (type === PSEUDO_ELEMENT_SELECTOR || type === TYPE_SELECTOR || type === PSEUDO_CLASS_SELECTOR) {
110-
const name = node.name || node.text || ''
111-
if (is_vendor_prefixed(name)) {
123+
if (node.is_vendor_prefixed) {
112124
complexity++
113125
}
114126
}

‎src/vendor-prefix.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { is_vendor_prefixed } from '@projectwallace/css-parser'
22

3+
/** Kept for backwards compatibility */
34
export function hasVendorPrefix(keyword: string): boolean {
45
return is_vendor_prefixed(keyword)
56
}

0 commit comments

Comments
 (0)