Skip to content
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

Wrong color after cleaning, in a very specific case #551

Closed
hostep opened this issue Apr 27, 2015 · 5 comments
Closed

Wrong color after cleaning, in a very specific case #551

hostep opened this issue Apr 27, 2015 · 5 comments
Labels

Comments

@hostep
Copy link

hostep commented Apr 27, 2015

We encountered a strange problem today. I could reduce it to the following input (I came from a > 600 KB css file, so it took me a while to reduce it, but I can't reduce it any further, or the bug disappears).

Input:

button:hover,
a.remove.focus {
  color: #ffffff;
}
button:hover {
  color: #1a1a18;
  background: #ffffff;
  border-color: #1a1a18;
}
.sub-button {
  color: #1a1a18;
  border-color: #1a1a18;
}
.sub-button:hover {
  color: #ffffff;
}

Cleaning it with clean-css, using --s0 and no sourcemaps, it gives this output (beautified for readability):

.sub-button, button:hover {
    color: #1a1a18;
    border-color: #1a1a18
}
a.remove.focus, button:hover {
    color: #fff
}
button:hover {
    background: #fff
}
.sub-button:hover {
    color: #fff
}

The problem here is with the color of the button:hover selector. It should be #1a1a18, but clean-css turns it into #fff

I tested this both with 3.1.9 and 3.2.5

@jakubpawlowicz
Copy link
Collaborator

That's interesting as button:hover shouldn't get that far up. So far you can skip it using --skip-restructuring switch.

@hostep
Copy link
Author

hostep commented Apr 27, 2015

Ok, we will use the --skip-restructuring flag for now. Thanks for the feedback!

@bevacqua
Copy link

I have the same issue, some CSS gets hoisted above where it should, breaking my layouting. See: https://www.diffchecker.com/aupxinqt

The lj-mailing-cta{display:block piece is hoisted way up, above lk-button rules, inverting specificity.

jakubpawlowicz added a commit that referenced this issue May 3, 2015
There was a bug in restructuring algorithm which allowed properties
to be moved too high up by using multi property moves.

This commit changes the behavior to drop a multi-property move on
a first occasion, i.e. when one of properties with different value
is encountered.
@jakubpawlowicz
Copy link
Collaborator

@hostep It's fixed in 3.2.7.

@hostep
Copy link
Author

hostep commented May 3, 2015

Awesome, thanks!

jakubpawlowicz added a commit that referenced this issue May 4, 2015
Regression from v3.2.7 where we forgot to check if selectors are
special or not. See a fix to #551.
jakubpawlowicz added a commit that referenced this issue May 4, 2015
Regression from v3.2.7 where we forgot to check if selectors are
special or not. See a fix to #551.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants