question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

:root { .some-class & { ... } } does not work as expected

See original GitHub issue

Version

2.1.0

Reproduction

https://www.webpackbin.com/bins/-Kn_3D4-c-UzcHsTAZyh

Steps to reproduce

injectGlobal`
  :root {
    .some-class & {
      color: red;
    }
  }
`

Expected Behavior

Should produce .some-class:root selector

Actual Behavior

instead of .some-class :root which does not work as expected. (Old parser was smart enough to remove that space).

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
thysultancommented, Jun 26, 2017

Managed to reproduce, it’s when the namespace value is an empty string – "", Which is how i think injectGlobal uses stylis to process global css.

Should be fixed in the next patch release.

0reactions
kittencommented, Jun 26, 2017

sorry, was afk for a bit 😉 yea, we’re passing an empty namespace there, since it’s global css 😃

https://github.com/styled-components/styled-components/blob/master/src/utils/stringifyRules.js#L27

Read more comments on GitHub >

github_iconTop Results From Across the Web

cannot define pseudo states inside complex selectors · Issue #360 ...
I am trying to put states on some element which is not the root element. Maybe I am doing something wrong, but this...
Read more >
How to add "class" to host element? - angular - Stack Overflow
This CSS is defined inside the component and the selector is only applied if the class someClass is set on the host element...
Read more >
Root file writing questions - ROOT Forum
Hi Rooters, I have two questions regarding writing in root file. It might be very simple question but I could not find clue....
Read more >
Test with Jest and calling public method on component
I have a component that works as expected. ... Custom elements and attributes do not register their view model instances with the root...
Read more >
not - CSS-Tricks
The :not() property in CSS is a negation pseudo class and accepts a simple selector or a selector list as an argument.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found