Commit 8f039f0c authored by webchick's avatar webchick

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

parent 02f199f6
......@@ -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(
......
......@@ -99,7 +99,7 @@ function testRenderExternal() {
*/
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.');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment