diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index 9c542c19d..0661470ee 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -13,7 +13,7 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
| [
Charlike Mike Reagent](http://www.tunnckocore.tk)
[💻](https://github.com/cssnano/cssnano/commits?author=tunnckoCore "Code") [⚠️](https://github.com/cssnano/cssnano/commits?author=tunnckoCore "Tests") | [
Vyacheslav Shebanov](https://github.com/Termina1)
[📖](https://github.com/cssnano/cssnano/commits?author=Termina1 "Documentation") | [
Marek ‘saji’ Augustynowicz](http://twitter.com/saji_)
[💻](https://github.com/cssnano/cssnano/commits?author=marek-saji "Code") [⚠️](https://github.com/cssnano/cssnano/commits?author=marek-saji "Tests") | [
Jonny Gerig Meyer](www.oddbird.net)
[💻](https://github.com/cssnano/cssnano/commits?author=jgerigmeyer "Code") [⚠️](https://github.com/cssnano/cssnano/commits?author=jgerigmeyer "Tests") | [
Fredrik Nicol](https://github.com/faddee)
[💻](https://github.com/cssnano/cssnano/commits?author=faddee "Code") [⚠️](https://github.com/cssnano/cssnano/commits?author=faddee "Tests") | [
Vlad Magdalin](www.webflow.com)
[📖](https://github.com/cssnano/cssnano/commits?author=callmevlad "Documentation") | [
Dmitry Semigradsky](http://brainstorage.me/semigradsky)
[📖](https://github.com/cssnano/cssnano/commits?author=Semigradsky "Documentation") |
| [
Selwyn](https://selwyn.cc/)
[💻](https://github.com/cssnano/cssnano/commits?author=Siilwyn "Code") [⚠️](https://github.com/cssnano/cssnano/commits?author=Siilwyn "Tests") | [
Matt Basta](http://mattbasta.com)
[💻](https://github.com/cssnano/cssnano/commits?author=mattbasta "Code") | [
James Kolce](https://www.jameskolce.com)
[📖](https://github.com/cssnano/cssnano/commits?author=jameskolce "Documentation") | [
Matthew](http://mattkemp.info/)
[💻](https://github.com/cssnano/cssnano/commits?author=techmatt101 "Code") [⚠️](https://github.com/cssnano/cssnano/commits?author=techmatt101 "Tests") | [
Steven Vachon](https://svachon.com)
[📖](https://github.com/cssnano/cssnano/commits?author=stevenvachon "Documentation") | [
Maxime Thirouin](https://moox.io/)
[💻](https://github.com/cssnano/cssnano/commits?author=MoOx "Code") [⚠️](https://github.com/cssnano/cssnano/commits?author=MoOx "Tests") | [
Sindre Sorhus](https://sindresorhus.com)
[📖](https://github.com/cssnano/cssnano/commits?author=sindresorhus "Documentation") [🔧](#tool-sindresorhus "Tools") |
| [
Simon Lydell](https://github.com/lydell)
[📖](https://github.com/cssnano/cssnano/commits?author=lydell "Documentation") | [
Chris Eppstein](http://chriseppstein.github.com)
[💻](https://github.com/cssnano/cssnano/commits?author=chriseppstein "Code") [⚠️](https://github.com/cssnano/cssnano/commits?author=chriseppstein "Tests") | [
darthmaim](https://gw2treasures.com/)
[💻](https://github.com/cssnano/cssnano/commits?author=darthmaim "Code") | [
pigcan](https://github.com/pigcan)
[💻](https://github.com/cssnano/cssnano/commits?author=pigcan "Code") [⚠️](https://github.com/cssnano/cssnano/commits?author=pigcan "Tests") | [
Evilebot Tnawi](https://github.com/evilebottnawi)
[💻](https://github.com/cssnano/cssnano/commits?author=evilebottnawi "Code") [📖](https://github.com/cssnano/cssnano/commits?author=evilebottnawi "Documentation") [⚠️](https://github.com/cssnano/cssnano/commits?author=evilebottnawi "Tests") | [
Grachev Evgeniy](https://twitter.com/_evless)
[💻](https://github.com/cssnano/cssnano/commits?author=evless "Code") | [
Anton Tuzhik](https://github.com/An-Tu)
[💻](https://github.com/cssnano/cssnano/commits?author=An-Tu "Code") [⚠️](https://github.com/cssnano/cssnano/commits?author=An-Tu "Tests") |
-| [
Ben McKernan](https://github.com/ben-mckernan)
[💻](https://github.com/cssnano/cssnano/commits?author=ben-mckernan "Code") [⚠️](https://github.com/cssnano/cssnano/commits?author=ben-mckernan "Tests") | [
Ian Walter](https://iankwalter.com)
[💻](https://github.com/cssnano/cssnano/commits?author=ianwalter "Code") |
+| [
Ben McKernan](https://github.com/ben-mckernan)
[💻](https://github.com/cssnano/cssnano/commits?author=ben-mckernan "Code") [⚠️](https://github.com/cssnano/cssnano/commits?author=ben-mckernan "Tests") | [
Ian Walter](https://iankwalter.com)
[💻](https://github.com/cssnano/cssnano/commits?author=ianwalter "Code") | [
MapTo0](https://github.com/MapTo0)
[💻](https://github.com/cssnano/cssnano/commits?author=MapTo0 "Code") [⚠️](https://github.com/cssnano/cssnano/commits?author=MapTo0 "Tests")
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!
diff --git a/packages/postcss-merge-rules/src/__tests__/index.js b/packages/postcss-merge-rules/src/__tests__/index.js
index 5a342f43d..1b9e01f66 100644
--- a/packages/postcss-merge-rules/src/__tests__/index.js
+++ b/packages/postcss-merge-rules/src/__tests__/index.js
@@ -597,6 +597,13 @@ test(
'.a,.b{display: flex;ALL: initial;border-radius: 2px;color: blue;}.a{margin: 10px 20px;font-size: 10px;}.b{margin: 10px 30px;font-size: 20px;}'
);
+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 merge multiple media queries',
processCSS,
diff --git a/packages/postcss-merge-rules/src/index.js b/packages/postcss-merge-rules/src/index.js
index a4f0b4bb8..1a8d39558 100644
--- a/packages/postcss-merge-rules/src/index.js
+++ b/packages/postcss-merge-rules/src/index.js
@@ -89,6 +89,11 @@ function canMerge (ruleA, ruleB, browsers, compatibilityCache) {
const b = ruleB.selectors;
const selectors = a.concat(b);
+ const hasHost = selectors.some(selector => selector.includes(":host"));
+
+ if (hasHost) {
+ return false;
+ }
if (!ensureCompatibility(selectors, browsers, compatibilityCache)) {
return false;