Browse Source

fix global selectors transform (#98)

add-plugins-support
Naoyuki Kanezawa 8 years ago
committed by Guillermo Rauch
parent
commit
a9630e5ef5
  1. 2
      lib/style-transform.js
  2. 8
      test/fixtures/transform.css
  3. 2
      test/fixtures/transform.out.css

2
lib/style-transform.js

@ -356,7 +356,7 @@
// flush remainder
if (piece.length) {
_line += piece
if (!inCombinatorOrPseudo) {
if (!inGlobal && !inCombinatorOrPseudo) {
_line += suffix
}
}

8
test/fixtures/transform.css

@ -2,6 +2,14 @@
color: blue
}
:global(p){
color: blue;
}
:global(p), a {
color: blue;
}
p {
color: red;
}

2
test/fixtures/transform.out.css

@ -1 +1 @@
p {color: blue}p[data-jsx="123"] {color: red;}p[data-jsx="123"]{color: red}*[data-jsx="123"] {color: blue;}[href="woot"][data-jsx="123"] {color: red;}p[data-jsx="123"] a[data-jsx="123"] span[data-jsx="123"] {color: red;}p[data-jsx="123"] span {background: blue}p[data-jsx="123"] a[title="'w ' ' t'"][data-jsx="123"] {margin: auto}p[data-jsx="123"] span:not(.test) {color: green}p[data-jsx="123"],h1[data-jsx="123"] {color: blue;-webkit-animation:a123hahaha 3s ease forwards infinite;-moz-animation:a123hahaha 3s ease forwards infinite;animation:a123hahaha 3s ease forwards infinite;-webkit-animation-name:a123hahaha;-moz-animation-name:a123hahaha;animation-name:a123hahaha;-webkit-animation-delay:100ms;-moz-animation-delay:100ms;animation-delay:100ms;}p[data-jsx="123"]:hover {color: red;}p[data-jsx="123"]::before {color: red;}[data-jsx="123"]:hover {color: red;}[data-jsx="123"]::before {color: red;}[data-jsx="123"]:hover p[data-jsx="123"] {color: red;}p[data-jsx="123"] + a[data-jsx="123"] {color: red;}p[data-jsx="123"] ~ a[data-jsx="123"] {color: red;}p[data-jsx="123"] > a[data-jsx="123"] {color: red;}p[data-jsx="123"] >> a[data-jsx="123"] {color: red;}@-webkit-keyframes a123hahaha {from { top: 0 }to { top: 100 }}@-moz-keyframes a123hahaha {from { top: 0 }to { top: 100 }}@keyframes a123hahaha {from { top: 0 }to { top: 100 }}@media (min-width: 500px) {.test[data-jsx="123"] {color: red;}}.test[data-jsx="123"] {display: block;}
p {color: blue}p{color: blue;}p,a[data-jsx="123"] {color: blue;}p[data-jsx="123"] {color: red;}p[data-jsx="123"]{color: red}*[data-jsx="123"] {color: blue;}[href="woot"][data-jsx="123"] {color: red;}p[data-jsx="123"] a[data-jsx="123"] span[data-jsx="123"] {color: red;}p[data-jsx="123"] span {background: blue}p[data-jsx="123"] a[title="'w ' ' t'"][data-jsx="123"] {margin: auto}p[data-jsx="123"] span:not(.test) {color: green}p[data-jsx="123"],h1[data-jsx="123"] {color: blue;-webkit-animation:a123hahaha 3s ease forwards infinite;-moz-animation:a123hahaha 3s ease forwards infinite;animation:a123hahaha 3s ease forwards infinite;-webkit-animation-name:a123hahaha;-moz-animation-name:a123hahaha;animation-name:a123hahaha;-webkit-animation-delay:100ms;-moz-animation-delay:100ms;animation-delay:100ms;}p[data-jsx="123"]:hover {color: red;}p[data-jsx="123"]::before {color: red;}[data-jsx="123"]:hover {color: red;}[data-jsx="123"]::before {color: red;}[data-jsx="123"]:hover p[data-jsx="123"] {color: red;}p[data-jsx="123"] + a[data-jsx="123"] {color: red;}p[data-jsx="123"] ~ a[data-jsx="123"] {color: red;}p[data-jsx="123"] > a[data-jsx="123"] {color: red;}p[data-jsx="123"] >> a[data-jsx="123"] {color: red;}@-webkit-keyframes a123hahaha {from { top: 0 }to { top: 100 }}@-moz-keyframes a123hahaha {from { top: 0 }to { top: 100 }}@keyframes a123hahaha {from { top: 0 }to { top: 100 }}@media (min-width: 500px) {.test[data-jsx="123"] {color: red;}}.test[data-jsx="123"] {display: block;}

Loading…
Cancel
Save