We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0dbbeb0 commit 17f1d13Copy full SHA for 17f1d13
src/lib/resolveDefaultsAtRules.js
@@ -17,7 +17,31 @@ function minimumImpactSelector(nodes) {
17
return true
18
})
19
20
- return [nodes[0], ...rest].join('').trim()
+ let [bestNode] = nodes
21
+
22
+ for (let [type, getNode = (n) => n] of [
23
+ ['class'],
24
+ [
25
+ 'id',
26
+ (n) =>
27
+ selectorParser.attribute({
28
+ attribute: 'id',
29
+ operator: '=',
30
+ value: n.value,
31
+ quoteMark: '"',
32
+ }),
33
+ ],
34
+ ['attribute'],
35
+ ]) {
36
+ let match = nodes.find((n) => n.type === type)
37
38
+ if (match) {
39
+ bestNode = getNode(match)
40
+ break
41
+ }
42
43
44
+ return [bestNode, ...rest].join('').trim()
45
}
46
47
let elementSelectorParser = selectorParser((selectors) => {
0 commit comments