diff --git a/index.js b/index.js index 1b42b51..19cf423 100644 --- a/index.js +++ b/index.js @@ -46,7 +46,7 @@ module.exports = ({ while (container !== null && container.type !== 'root') { if ( container.type === 'atrule' && - container.params.includes('hover: hover') + (container.params.includes('hover: hover') || container.params.includes('hover:hover')) ) { return true } diff --git a/index.test.js b/index.test.js index c9e74c7..5ce2292 100644 --- a/index.test.js +++ b/index.test.js @@ -62,6 +62,18 @@ describe('basic usage', () => { ) }) + it('skips rules contained within `@media (hover:hover) {}` - no space used', () => { + run( + '@media (hover:hover) {.btn:hover {}}', + '@media (hover:hover) {.btn:hover {}}' + ) + + run( + '.p-index { @media (hover:hover) {.btn:hover {}} }', + '.p-index { @media (hover:hover) {.btn:hover {}} }' + ) + }) + it('works with pseudo-class functions that accept selector lists as an argument', () => { run( ':is(button, [role="button"]):hover { background-color: transparent; }',