Fix lost combinator before global (#30771)
This commit is contained in:
parent
2004d49198
commit
5f72810dd6
3 changed files with 30 additions and 1 deletions
|
@ -138,7 +138,7 @@ impl VisitMut for Namespacer {
|
||||||
handler
|
handler
|
||||||
.struct_span_err(
|
.struct_span_err(
|
||||||
selector.span,
|
selector.span,
|
||||||
"Failed to parse tokens inside one off global selector",
|
"Failed to transform one off global selector",
|
||||||
)
|
)
|
||||||
.emit()
|
.emit()
|
||||||
});
|
});
|
||||||
|
@ -187,6 +187,16 @@ impl Namespacer {
|
||||||
.cloned()
|
.cloned()
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
if v.is_empty() {
|
||||||
|
bail!("Failed to transform one off global selector");
|
||||||
|
}
|
||||||
|
|
||||||
|
if node.combinator.is_some() && v[0].combinator.is_some() {
|
||||||
|
bail!("Failed to transform one off global selector");
|
||||||
|
} else if node.combinator.is_some() {
|
||||||
|
v[0].combinator = node.combinator;
|
||||||
|
}
|
||||||
|
|
||||||
v.iter_mut().for_each(|sel| {
|
v.iter_mut().for_each(|sel| {
|
||||||
if i < node.subclass_selectors.len() {
|
if i < node.subclass_selectors.len() {
|
||||||
sel.subclass_selectors
|
sel.subclass_selectors
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
const Test = () => (
|
||||||
|
<div>
|
||||||
|
<span>test</span>
|
||||||
|
<style jsx>{`
|
||||||
|
div > :global(span) {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
`}</style>
|
||||||
|
</div>
|
||||||
|
)
|
|
@ -0,0 +1,9 @@
|
||||||
|
import _JSXStyle from "styled-jsx/style";
|
||||||
|
const Test = ()=><div className={"jsx-5a206f122d1cb32e"}>
|
||||||
|
|
||||||
|
<span className={"jsx-5a206f122d1cb32e"}>test</span>
|
||||||
|
|
||||||
|
<_JSXStyle id={"5a206f122d1cb32e"}>{"div.jsx-5a206f122d1cb32e >span {color:red}"}</_JSXStyle>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
;
|
Loading…
Reference in a new issue