summaryrefslogtreecommitdiff
path: root/framework/Web
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web')
-rw-r--r--framework/Web/Javascripts/TJavaScript.php24
1 files changed, 15 insertions, 9 deletions
diff --git a/framework/Web/Javascripts/TJavaScript.php b/framework/Web/Javascripts/TJavaScript.php
index 228dc88f..4dce8e2e 100644
--- a/framework/Web/Javascripts/TJavaScript.php
+++ b/framework/Web/Javascripts/TJavaScript.php
@@ -153,20 +153,26 @@ class TJavaScript
return $value?'true':'false';
else if(is_array($value))
{
- $results=array();
- if($toMap)
+ $results='';
+ if(($n=count($value))>0 && array_keys($value)!==range(0,$n-1))
{
foreach($value as $k=>$v)
- if($v!=='')
- $results[]="'{$k}':".self::encode($v,$toMap);
- return '{'.implode(',',$results).'}';
+ {
+ if($results!=='')
+ $results.=',';
+ $results.="'$k':".self::encode($v,$toMap);
+ }
+ return '{'.$results.'}';
}
else
{
- foreach($value as $k=>$v)
- if($v!=='')
- $results[]=self::encode($v,$toMap);
- return '['.implode(',',$results).']';
+ foreach($value as $v)
+ {
+ if($results!=='')
+ $results.=',';
+ $results.=self::encode($v,$toMap);
+ }
+ return '['.$results.']';
}
}
else if(is_integer($value))