Skip to content

:host-context selectors are being optimized incorrectly in level 2 #1062

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

Closed
alan-agius4 opened this issue Mar 8, 2019 · 1 comment
Closed
Labels

Comments

@alan-agius4
Copy link

Precheck

  • Do a quick search and make sure a bug has not yet been reported;
  • do a quick check if the bug still exists in the latest patch version;
  • finally, be nice and have fun!

Environment

  • clean-css version - 4.2.1:
  • node.js version - 10.12:
  • operating system: Win32

Configuration options

var CleanCSS = require('clean-css');
new CleanCSS({
    compatibility: 'ie9',
    level: 2,
    format: {
        aroundSelectorRelation: false,
    },
    inline: false,
    returnPromise: true,
    sourceMap: this._options.sourceMap,
});

Input CSS

:host-context(selector selector){
	color: red;
}

Actual output CSS

:host-context(selectorselector){color:red}

Expected output CSS

:host-context(selector selector){color:red}
@SebastianPodgajny
Copy link

Problem is in level 1 tidySelectors option

Here is code that skips this space
isWhitespace = true
roundBracketLevel = 1
isQuoted = false
https://github.com/jakubpawlowicz/clean-css/blob/dc728a8167b7b6f62906115c560be2f5b530f9f6/lib/optimizer/level-1/tidy-rules.js#L114-L115

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