From 9cec02e4728f27eeb21c43c37633c819d379ddeb Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 2 Aug 2008 18:56:53 +0000 Subject: =?UTF-8?q?-=20Patch=20#158992=20by=20sun,=20quicksketch,=20zeta?= =?UTF-8?q?=20=CE=B6,=20bangpound,=20Dries=20et=20al:=20inline=20Javascrip?= =?UTF-8?q?t=20could=20generate=20invalid=20XHTML.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- includes/common.inc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'includes/common.inc') diff --git a/includes/common.inc b/includes/common.inc index 3d5bff905..46dba975d 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -2063,17 +2063,22 @@ function drupal_get_js($scope = 'header', $javascript = NULL) { // page request. $query_string = '?' . substr(variable_get('css_js_query_string', '0'), 0, 1); + // For inline Javascript to validate as XHTML, all Javascript 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\n"; + foreach ($javascript as $type => $data) { - if (!$data) continue; switch ($type) { case 'setting': - $output .= '\n"; + $output .= '\n"; break; case 'inline': foreach ($data as $info) { - $output .= '\n"; + $output .= '\n"; } break; default: -- cgit v1.2.3