stubbornella/csslint — pull request #282 by mahonnaise (2012-05-26 00:17:14+00:00)
Title: New rule which looks for new-line characters in selectors

New-line characters are usually a forgotten comma, not a descendant combinator.

While the spec defines the descendant combinator as any kind of whitespace [1], no one seems to use new-line characters deliberately for this. After all, it looks like an editing mistake and usually it is indeed an editing mistake. Furthermore, most people do not know that "E F" and "E\nF" are the actually same. So, they won't even consider that this might have been done on purpose.

Not okay:

.foo
.bar {
color: #ccc;
}

**Yields:** "new-line character found in selector (forgot a comma?)"

Most likely was supposed to mean this:

.foo,
.bar {
color: #ccc;
}

If that was indeed supposed to be a descendant combinator, it should have been written like this:

.foo .bar {
color: #ccc;
}

---

[1] http://www.w3.org/TR/css3-selectors/#descendant-combinators

>A descendant combinator is whitespace that separates two sequences of simple selectors.