Js-beautify: Adjacent and direct descendant selectors are not space separated

Created on 26 Apr 2015  路  11Comments  路  Source: beautify-web/js-beautify

Altought the CSS rule for "selector_separator" is set to " " (space character) this doesn't apply to rules that use direct descendant selectors or adjacent selectors. For example the following code...

a+b {
    ...
}

a>b {
    ...
}

... doesn't get formatted into this:

a + b {
     ...
}

a > b {
    ...
}
css bug

All 11 comments

So, the space shouldn't be added, but is?

Nope, quite the opposite: the space should be added but isn't.

Oh, okay. :smile:
What would you expect to see if "selector_separator" were set to "n"?

I suppose to see each selector on a separate line, even if they are part of the same rule. So I would expect this code:

.one .two .three {
    ...
}

to be formatted into this:

.one
.two
.three {
    ...
}

What about your original example?

a>b {
    ...
}

would turn into this:

a
>
b {
    ...
}

This issue had it's one year birthday yesterday. :) Any updates on it?

Nope. This project is widely used and I devote what time I can to it, but it needs more contributors.

@raduluchian - Have you tried setting space_around_selector_separator = true?
The name is odd, but I think that will do what you want.

@bitwiseman The space_around_selector_separator parameter set to true fix this issue.

Though, it should be like that by default: I cannot think of a situation where you wouldn't want js-beautify-css not to add (or maintain existing spaces) between + or > relationship separators because it breaks your CSS rules (I mean, it is not an "aesthetic" bug).

For anyone wondering, this has been update to space_around_combinator

Was this page helpful?
0 / 5 - 0 ratings

Related issues

buinauskas picture buinauskas  路  5Comments

Hirse picture Hirse  路  3Comments

iofjuupasli picture iofjuupasli  路  4Comments

Gennady-G picture Gennady-G  路  4Comments

knocte picture knocte  路  5Comments