Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the String(string) form of string coercion #535

Merged
merged 1 commit into from
Aug 15, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/handlebars/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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);
Expand Down