zweilove/css_splitter — pull request #30 by Umofomia (2014-04-23 19:21:44+00:00)
Title: Properly handle media query closing braces

I noticed media query blocks weren't properly being handled when they occur entirely before the split. For instance, for the following CSS:

```css
@media print {
.media-rule { color: black; }
}
.a0 { color: black; }
.a1 { color: black; }
/* ... */
.a4094 { color: black; }
.first-after-split { color: black; }
```

We would expect that the split would just contain this:

```css
.first-after-split { color: black; }
```

However, without this fix, it ends up containing this:

```css
@media print {
.a4094 { color: black; }
.first-after-split { color: black; }
}
```

This was caused by two issues:

* `extract_part` only checked for the closing brace under the `if selector_range.cover? selectors_count` condition. Because of this, it never knew that the media block had closed. This fix moves that check outside of that condition.
* `count_selectors_of_rule` incorrectly counted the closing brace of the media query as a selector. This fix takes this into account.