Showing
1 changed file
with
10 additions
and
1 deletions
@@ -136,7 +136,16 @@ Controller.prototype.client=function(res,views,model,clientmodel){ | @@ -136,7 +136,16 @@ Controller.prototype.client=function(res,views,model,clientmodel){ | ||
136 | if(!model){ | 136 | if(!model){ |
137 | model={}; | 137 | model={}; |
138 | } | 138 | } |
139 | - ViewModel="<script>var ViewModel="+JSON.stringify(model)+";</script>"; | 139 | + var json_str = JSON.stringify(model); |
140 | + var cx = /[\u00A0\u2028\u2029\uFEFF]/g; | ||
141 | + | ||
142 | + if (cx.test(json_str)) { | ||
143 | + console.log("------------------") | ||
144 | + json_str = json_str.replace(cx, function () { | ||
145 | + return ""; | ||
146 | + }); | ||
147 | + } | ||
148 | + ViewModel="<script>var ViewModel="+json_str+";</script>"; | ||
140 | var src=""; | 149 | var src=""; |
141 | 150 | ||
142 | 151 |
-
Please register or login to post a comment