Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent merging of :host(tag) and tag #876

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/css-size/src/__tests__/index.js
Expand Up @@ -4,7 +4,7 @@ import path from 'path';
import colors from 'colors/safe';
import size, { table, numeric } from '../';

jest.setTimeout(15000);
jest.setTimeout(30000);

let noopProcessorPath = path.resolve(__dirname, '../../processors/noop.js');

Expand Down
8 changes: 8 additions & 0 deletions packages/postcss-merge-rules/src/__tests__/index.js
Expand Up @@ -787,6 +787,14 @@ test(
)
);

test(
'should not merge :host(tagname) with tagname',
processCSS(
':host(tag){display:block}tag{display:block}',
':host(tag){display:block}tag{display:block}'
)
);

test(
'should not merge :focus-visible',
processCSS(
Expand Down
6 changes: 6 additions & 0 deletions packages/postcss-merge-rules/src/index.js
Expand Up @@ -96,6 +96,12 @@ function canMerge(ruleA, ruleB, browsers, compatibilityCache) {

const selectors = a.concat(b);

const hasHost = selectors.some((selector) => selector.includes(':host'));

if (hasHost) {
return false;
}

if (!ensureCompatibility(selectors, browsers, compatibilityCache)) {
return false;
}
Expand Down