styled-jsx icon indicating copy to clipboard operation
styled-jsx copied to clipboard

Selectors with `:last-child` wrapped on second line generates incorrect styles

Open danielhusar opened this issue 4 years ago • 0 comments

With this styles:

<div className="baz">Hi there!</div>
<style jsx>{`
.foo
.bar:last-child
.baz {
  color: red;
}
`}
</style>
Screen Shot 2020-04-29 at 14 49 10

Hi there! will become red, even that it shouldnt.

Making the selector into one line fixes it:

<div className="baz">Hi there!</div>
<style jsx>{`
.foo .bar:last-child .baz {
  color: red;
}
`}
</style>

Or removing :last-child fixes it too:

<div className="baz">Hi there!</div>
<style jsx>{`
.foo
.bar
.baz {
  color: red;
}
`}
</style>
  • OS: OSX 10.15.4
  • Browser: Latest Chrome
  • styled-jsx (version): 3.2.5

danielhusar avatar Apr 29 '20 21:04 danielhusar