summaryrefslogtreecommitdiff
path: root/it_html.class
diff options
context:
space:
mode:
Diffstat (limited to 'it_html.class')
-rw-r--r--it_html.class14
1 files changed, 6 insertions, 8 deletions
diff --git a/it_html.class b/it_html.class
index 9bb8e7a..bab85da 100644
--- a/it_html.class
+++ b/it_html.class
@@ -546,18 +546,16 @@ static function U(...$args)
*/
function js($args)
{
- $args = it::map(fn($v) => it::replace(['<!--' => '\\x3C!--', '<script' => '\\x3Cscript', '</script' => '\\x3C/script'], $v), $args);
+ list($base, $params) = it_parse_args($args);
+ $base= it::replace(['<!--' => '\\x3C!--', '<script' => '\\x3Cscript', '</script' => '\\x3C/script'], $base);
- if (($this->p['htmltype'][0] == 'x') && $args[0] && ((array)$args[0] === array_values((array)$args[0])))
- {
- array_unshift($args, "<!--//--><![CDATA[//><!--\n");
- $args[] = "\n//--><!]]>";
- }
+ if (($this->p['htmltype'][0] == 'x') && strlen($base))
+ $base = "<!--//--><![CDATA[//><!--\n$base\n//--><!]]>";
if ($this->p['htmltype'] != "html5")
- array_unshift($args, array('type' => 'text/javascript'));
+ $params['type'] = 'text/javascript';
- return $this->_tag('script', $args);
+ return $this->_tag('script', [$base, $params]);
}