diff --git a/CHANGELOG b/CHANGELOG index ee50eb16e..6914fa894 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,7 @@ CHANGELOG Roundcube Webmail =========================== - Enigma: Add script to import keys from filesystem to the db storage (for multihost) +- Fix so type attribute on script tags is not used on HTML5 pages (#6975) RELEASE 1.4.1 ------------- diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php index ef66dd83d..891a64d84 100644 --- a/program/include/rcmail_output_html.php +++ b/program/include/rcmail_output_html.php @@ -1790,7 +1790,7 @@ EOF; public function add_script($script, $position = 'head') { if (!isset($this->scripts[$position])) { - $this->scripts[$position] = "\n" . rtrim($script); + $this->scripts[$position] = rtrim($script); } else { $this->scripts[$position] .= "\n" . rtrim($script); @@ -1852,7 +1852,7 @@ EOF; // put docready commands into page footer if (!empty($this->scripts['docready'])) { - $this->add_script('$(function(){ ' . $this->scripts['docready'] . "\n});", 'foot'); + $this->add_script("\$(function() {\n" . $this->scripts['docready'] . "\n});", 'foot'); } $page_header = ''; diff --git a/program/lib/Roundcube/html.php b/program/lib/Roundcube/html.php index af61c68e3..9fb3dda1c 100644 --- a/program/lib/Roundcube/html.php +++ b/program/lib/Roundcube/html.php @@ -256,18 +256,21 @@ class html if (is_string($attr)) { $attr = array('src' => $attr); } + if ($cont) { - if (self::$doctype == 'xhtml') - $cont = "\n/* */\n"; - else - $cont = "\n" . $cont . "\n"; + if (self::$doctype == 'xhtml') { + $cont = "/* */"; + } + + $cont = "\n{$cont}\n"; } - if (self::$doctype == 'xhtml') + if (self::$doctype == 'xhtml') { $attr += array('type' => 'text/javascript'); + } return self::tag('script', $attr + array('nl' => true), $cont, - array_merge(self::$common_attrib, array('src','type','charset'))); + array_merge(self::$common_attrib, array('src', 'type', 'charset'))); } /**