You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by lr...@apache.org on 2008/02/26 00:55:51 UTC
svn commit: r631044 - /incubator/shindig/trunk/features/core/util.js
Author: lryan
Date: Mon Feb 25 15:55:48 2008
New Revision: 631044
URL: http://svn.apache.org/viewvc?rev=631044&view=rev
Log:
Handle null & undefined. Dont escape number, boolean etc.
Modified:
incubator/shindig/trunk/features/core/util.js
Modified: incubator/shindig/trunk/features/core/util.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/core/util.js?rev=631044&r1=631043&r2=631044&view=diff
==============================================================================
--- incubator/shindig/trunk/features/core/util.js (original)
+++ incubator/shindig/trunk/features/core/util.js Mon Feb 25 15:55:48 2008
@@ -198,25 +198,23 @@
*/
escape : function(input, opt_escapeObjects) {
- if (typeof input == "string") {
+ if (!input) {
+ return input;
+ } else if (typeof input == "string") {
return gadgets.util.escapeString(input);
-
} else if (typeof input == "array") {
for (var i = 0; i < input.length; i++) {
input[i] = gadgets.util.escape(input[i]);
}
-
- } else if (opt_escapeObjects) {
+ } else if (typeof input == "object" && opt_escapeObjects) {
var newObject = {};
for (var field in input) if (input.hasOwnProperty(field)) {
newObject[gadgets.util.escapeString(field)]
= gadgets.util.escape(input[field], true);
}
return newObject;
-
- } else {
- return input;
}
+ return input;
},
/**