Skip to content

Commit

Permalink
Force toString in escapeExpression
Browse files Browse the repository at this point in the history
Fixes #211
  • Loading branch information
kpdecker committed Apr 6, 2013
1 parent f4d0092 commit 671c07e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions dist/handlebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
Expand Down
5 changes: 5 additions & 0 deletions dist/handlebars.runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
Expand Down
5 changes: 5 additions & 0 deletions lib/handlebars/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
Expand Down

0 comments on commit 671c07e

Please sign in to comment.