Merge pull request #535 from sorentwo/alternate-string-coercion

Use the String(string) form of string coercion
This commit is contained in:
Kevin Decker
2013-08-15 08:19:54 -07:00
+2 -2
View File
@@ -21,7 +21,7 @@ Handlebars.SafeString = function(string) {
this.string = string;
};
Handlebars.SafeString.prototype.toString = function() {
return this.string.toString();
return "" + this.string;
};
var escape = {
@@ -60,7 +60,7 @@ Handlebars.Utils = {
// Force a string conversion as this will be done by the append regardless and
// the regex test will do this transparently behind the scenes, causing issues if
// an object's to string has escaped characters in it.
string = string.toString();
string = "" + string;
if(!possible.test(string)) { return string; }
return string.replace(badChars, escapeChar);