Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
2.5.5, 2.6.2, 2.7
-
MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE
-
MOODLE_25_STABLE, MOODLE_26_STABLE
-
MDL-44936-master -
Description
The CSS function to chunk the CSS into multiple files is not reliable. And now that we are using Bootstrap it can be a real issue.
- Chunking can happen in the middle of a media query;
- Chunking does not support commas within rules.
Here is a bit of a testcase that demonstrates the problem:
diff --git a/lib/tests/csslib_test.php b/lib/tests/csslib_test.php
|
index a798e20..0def91a 100644
|
--- a/lib/tests/csslib_test.php
|
+++ b/lib/tests/csslib_test.php
|
@@ -1180,6 +1180,20 @@ CSS;
|
$chunks = css_chunk_by_selector_count($css, 'styles.php?type=test', 2, 0);
|
$this->assertInternalType('array', $chunks);
|
// I don't care what the outcome is, I just want to make sure it doesn't die.
|
+
|
+ // Test media queries.
|
+ $css = '@media (min-width: 980px) { .a,.b{} .c,.d{} }';
|
+ $chunks = css_chunk_by_selector_count($css, 'styles.php?type=test', 2, 0);
|
+ $this->assertCount(2, $chunks);
|
+ $this->assertSame('@media (min-width: 980px) { .a,.b{}}', $chunks[0]);
|
+ $this->assertSame('@media (min-width: 980px) { .c,.d{}}', $chunks[1]);
|
+
|
+ // Test special rules.
|
+ $css = 'a,b{ background-image: linear-gradient(to bottom, #ffffff, #cccccc);}d,e{}';
|
+ $chunks = css_chunk_by_selector_count($css, 'styles.php?type=test', 2, 0);
|
+ $this->assertCount(2, $chunks);
|
+ $this->assertSame('a,b{ background-image: linear-gradient(to bottom, #ffffff, #cccccc);}', $chunks[0]);
|
+ $this->assertSame('d,e{}', $chunks[1]);
|
}
|
|
/**
|
It is possible to replicate this bug using IE in designer mode (with MDL-44933 integrated). In non-designer mode I did not experience the issue, but I guess that's just a matter of luck.
This obviously only affects IE < 10
Attachments
Issue Links
- caused a regression
-
MDL-45535 CSS chunking breaks media rules if CSS invalid (IE)
-
- Closed
-
- Discovered while testing
-
MDL-45084 Chunking ignored for IE9 with theme designer mode disabled
-
- Closed
-
- duplicates
-
MDL-44856 IE8&9 CSS "chunking" doesn't seem to work correctly.
-
- Closed
-
- has been marked as being related by
-
MDL-45049 Make debugging() useful in background scripts such as styles(_debug).php
-
- Closed
-
- Testing discovered
-
MDL-44933 Styles are missing with designer mode enabled in IE < 10
-
- Closed
-