Skip to content

Commit 853012b

Browse files
authored
Fix false positive with :host and :host() (#24)
1 parent a5de9e6 commit 853012b

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

.tape.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ export default {
4747
expect: '.foo { color: blue; &:hover, &:focus { color: rebeccapurple; } } .foo:focus-within { color: red; }',
4848
args: ['always', { only: [':hover', ':focus'] }]
4949
},
50+
{
51+
source: ':host { color: blue; } :host(.foo) { color: rebeccapurple; }',
52+
expect: ':host { color: blue; } :host(.foo) { color: rebeccapurple; }',
53+
args: ['always']
54+
},
5055

5156
/* Test Nesting At-Rules */
5257
{

lib/are-rules-potential-nesting-rule.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export default function areRulesPotentialNestingRule(rule1, rule2, opts) {
88
rule2Selector.length < rule1Selector.length &&
99
rule2Selector === rule1Selector.slice(0, rule2Selector.length) &&
1010
!/^[A-Za-z0-9-_]/.test(rule1Selector.slice(rule2Selector.length)) &&
11+
rule1Selector[rule2Selector.length] !== '(' &&
1112
(!except.length || except.some(
1213
entry => entry instanceof RegExp
1314
? !entry.test(rule1Selector.slice(rule2Selector.length))

0 commit comments

Comments
 (0)