You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by li...@apache.org on 2009/12/07 19:57:41 UTC
svn commit: r888080 -
/incubator/shindig/trunk/features/src/main/javascript/features/core.util/util.js
Author: lindner
Date: Mon Dec 7 18:57:39 2009
New Revision: 888080
URL: http://svn.apache.org/viewvc?rev=888080&view=rev
Log:
avoid js errors for bad data
Modified:
incubator/shindig/trunk/features/src/main/javascript/features/core.util/util.js
Modified: incubator/shindig/trunk/features/src/main/javascript/features/core.util/util.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/src/main/javascript/features/core.util/util.js?rev=888080&r1=888079&r2=888080&view=diff
==============================================================================
--- incubator/shindig/trunk/features/src/main/javascript/features/core.util/util.js (original)
+++ incubator/shindig/trunk/features/src/main/javascript/features/core.util/util.js Mon Dec 7 18:57:39 2009
@@ -298,6 +298,7 @@
* @return {String} The escaped string
*/
escapeString : function(str) {
+ if (!str) return str;
var out = [], ch, shouldEscape;
for (var i = 0, j = str.length; i < j; ++i) {
ch = str.charCodeAt(i);
@@ -318,6 +319,7 @@
* @param {String} str The string to unescape.
*/
unescapeString : function(str) {
+ if (!str) return str;
return str.replace(/&#([0-9]+);/g, unescapeEntity);
}
};