Force toString in escapeExpression

Fixes #211
This commit is contained in:
kpdecker
2013-04-06 14:46:04 -05:00
parent f4d0092bb8
commit 671c07e699
3 changed files with 15 additions and 0 deletions
+5
View File
@@ -825,6 +825,11 @@ Handlebars.Utils = {
return "";
}
// 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();
if(!possible.test(string)) { return string; }
return string.replace(badChars, escapeChar);
},
+5
View File
@@ -211,6 +211,11 @@ Handlebars.Utils = {
return "";
}
// 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();
if(!possible.test(string)) { return string; }
return string.replace(badChars, escapeChar);
},
+5
View File
@@ -47,6 +47,11 @@ Handlebars.Utils = {
return "";
}
// 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();
if(!possible.test(string)) { return string; }
return string.replace(badChars, escapeChar);
},