-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pseudo-element selectors break compiled output #261
Comments
It might be an issue with empty rules and pseudo selectors, can you remove the empty rule in the meantime? cc @thysultan |
I thought it might be ASI, but i can't reproduce this with stylis, it emits the expected output: .other-selector#id{display: none;} |
@giuseppeg It can still happen when the rules aren't empty. It doesn't even have to be a pseudo-element selector, it might be a parsing issue: module.exports = `
.other-selector {
display: none;
}
.bad-selector:hover,
.bad-selector:focus
{
outline: none;
}
` "var __styledJsxDefaultExport = new String("{.bad-selector:hover, .bad-selector:focus}.other-selector{display:none}{outline:none}"); Edit: adding content to my original example did fix it though |
It also seems to have trouble with the @font-face {
font-family: 'Custom';
src: url('/font/Custom.bb4929e353324148ae5f0ee1c395fbd0.eot');
src: url('/font/Custom.bb4929e353324148ae5f0ee1c395fbd0.eot?#iefix') format('embedded-opentype'), ;
url('/font/Custom.bb4929e353324148ae5f0ee1c395fbd0.woff2') format('woff2'), url('/font/Custom-Regular.bb4929e353324148ae5f0ee1c395fbd0.woff') format('woff'), url('/font/Custom-Regular.bb4929e353324148ae5f0ee1c395fbd0.ttf') format('truetype');
font-weight: normal;
font-style: normal
} |
@unregistered can you paste the original css for the latests snippet? |
{.bad-selector:hover, .bad-selector:focus} @thysultan this is a bug in stylis and it happens when the curly bracket is in a new line .bad-selector:hover,
.bad-selector:focus
{ |
@giuseppeg This test covers that, what version are you trying this on? |
@giuseppeg Here's an example which produces bad output for that latest snippet, if you put it in the unit test suite:
Result:
The messed up part: |
Can't seem to reproduce any of them on stylis 3.2.6, so i think an upgrade to 3.2.6 would probably fix these. |
@unregistered fixed in 1.0.9 |
On the latest version 1.0.8:
When rendered in a react element:
I would expect to see:
I actually see
Which is invalid CSS, causing other styles defined in that block to be ignored.
I can replicate this by adding that code to one of the test fixtures and running the unit tests as well.
The text was updated successfully, but these errors were encountered: