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.

Preserve space between selector and > combinator

See original GitHub issue

When beautifying a CSS rule containing a > combinator, the combinator got stuck to the previous selector. Actually, even if it already formatted correctly, the space is removed. It makes quite difficult to use js-beautify in CSS files containing > combinators because it will produce selectors that won’t work.

Input

The code looked like this before beautification:

.foo > h3 {
    ...
}

Expected Output

I would expect the input to not change. The code should have looked like this after beautification:

/* Space here
    V */
.foo > h3 {
    ...
}

Actual Output

The code actually looked like this after beautification:

/* No space 
   V */
.foo> h3 {
    ...
}

Environment

OS: Archlinux with Emacs web-beautify.el

Also tested under command line only outside of Emacs.

Settings

Defaults

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
smonffcommented, Oct 26, 2016

It has been fixed in 1.6.4, it don’t happen anymore since I set space_around_combinator to true, my bad. This param should be true by default though.

3reactions
subfighter3commented, Jan 7, 2019

Hello! I still have a “no space” around any sibiling selector when I beautify a css file. I actually use atom-beautify.

Read more comments on GitHub >

github_iconTop Results From Across the Web

selector-combinator-space-before - Stylelint
Combinators are used to combine several different selectors into new and more specific ones.
Read more >
CSS combinator precedence? - Stack Overflow
No, there is no notion of precedence in combinators. However, there is a notion of order of elements in a complex selector.
Read more >
Understanding Combinators in CSS - Level Up Coding
A combinator is a way to define the relation between selectors. By using combinators, for example, we can target only child elements of...
Read more >
CSS Combinators - W3Schools
A combinator is something that explains the relationship between the selectors. A CSS selector can contain more than one simple selector.
Read more >
General sibling combinator - CSS: Cascading Style Sheets
The general sibling combinator (~) separates two selectors and matches all iterations of the second element, that are following the first ...
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