Issue #1021622 by amateescu, dags, K3vin: Fixed Improper escaping of CDATA for inline css.

8.0.x
webchick 2013-03-26 22:14:04 -07:00
parent 02f199f62b
commit 8f039f0cf1
2 changed files with 3 additions and 3 deletions

View File

@ -2969,8 +2969,8 @@ function drupal_pre_render_styles($elements) {
// For inline CSS to validate as XHTML, all CSS containing XHTML needs to be
// wrapped in CDATA. To make that backwards compatible with HTML 4, we need to
// comment out the CDATA-tag.
$embed_prefix = "\n<!--/*--><![CDATA[/*><!--*/\n";
$embed_suffix = "\n/*]]>*/-->\n";
$embed_prefix = "\n/* <![CDATA[ */\n";
$embed_suffix = "\n/* ]]> */\n";
// Defaults for LINK and STYLE elements.
$link_element_defaults = array(

View File

@ -99,7 +99,7 @@ class CascadingStylesheetsTest extends WebTestBase {
*/
function testRenderInlinePreprocess() {
$css = 'body { padding: 0px; }';
$css_preprocessed = '<style media="all">' . "\n<!--/*--><![CDATA[/*><!--*/\n" . drupal_load_stylesheet_content($css, TRUE) . "\n/*]]>*/-->\n" . '</style>';
$css_preprocessed = '<style media="all">' . "\n/* <![CDATA[ */\n" . drupal_load_stylesheet_content($css, TRUE) . "\n/* ]]> */\n" . '</style>';
drupal_add_css($css, array('type' => 'inline'));
$styles = drupal_get_css();
$this->assertEqual(trim($styles), $css_preprocessed, 'Rendering preprocessed inline CSS adds it to the page.');