only write the javascript CDATA blocks if the type is javascript (it's not the correct syntax for other languages)

This commit is contained in:
Craig Andrews 2009-12-04 19:44:45 -05:00
parent 4c8bed8ba0
commit 847013db69
1 changed files with 7 additions and 3 deletions

View File

@ -367,7 +367,7 @@ class HTMLOutputter extends XMLOutputter
* output a script (almost always javascript) tag with inline
* code.
*
* @param string $code relative or absolute script path
* @param string $code code to put in the script tag
* @param string $type 'type' attribute value of the tag
*
* @return void
@ -376,9 +376,13 @@ class HTMLOutputter extends XMLOutputter
function inlineScript($code, $type='text/javascript')
{
$this->elementStart('script', array('type' => $type));
$this->raw('/*<![CDATA[*/ '); // XHTML compat for Safari
if($type == 'text/javascript') {
$this->raw('/*<![CDATA[*/ '); // XHTML compat
}
$this->raw($code);
$this->raw(' /*]]>*/'); // XHTML compat for Safari
if($type == 'text/javascript') {
$this->raw(' /*]]>*/'); // XHTML compat
}
$this->elementEnd('script');
}