MDL-45535 CSS chunking breaks media rules if CSS invalid (IE)

Invalid CSS with extra } symbols, which previously (by fluke)
worked, was broken by recent chunking improvements. This change
makes the chunking code robust against this (stupid) situation.
This commit is contained in:
sam marshall
2014-05-14 12:08:27 +01:00
parent c1ed254643
commit fbe79e4937
2 changed files with 23 additions and 0 deletions
+6
View File
@@ -195,6 +195,12 @@ function css_chunk_by_selector_count($css, $importurl, $maxselectors = 4095, $bu
}
} else {
$inrule--;
// Handle stupid broken CSS where there are too many } brackets,
// as this can cause it to break (with chunking) where it would
// coincidentally have worked otherwise.
if ($inrule < 0) {
$inrule = 0;
}
}
// We are not in a media query, and there is no pending rule, it is safe to split here.