From 2bab7be637da89f489518e7d219e13b754ae783e Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Sat, 22 May 2010 18:32:03 +0200 Subject: [PATCH] Less code per line, fix Rhino compat. --- CHANGES.md | 1 + THANKS.md | 1 + mustache.js | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index cdd3858..d833415 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,7 @@ ## 0.3.0 (??-??-????) +* Fix Rhino compat. * CommonJS packaging is no longer a special case. * DRY Rakefile. * Allow whitespace around tag names. diff --git a/THANKS.md b/THANKS.md index 9843374..6dac939 100644 --- a/THANKS.md +++ b/THANKS.md @@ -17,3 +17,4 @@ Mustache.js wouldn't kick ass if it weren't for these fine souls: * dpree * Jason Smith / jhs * Aaron Gibralter / agibralter + * Ross Boucher / boucher diff --git a/mustache.js b/mustache.js index dc82698..545b0bd 100644 --- a/mustache.js +++ b/mustache.js @@ -240,7 +240,8 @@ var Mustache = function() { Does away with nasty characters */ escape: function(s) { - return ((s == null) ? "" : s).toString().replace(/&(?!\w+;)|["<>\\]/g, function(s) { + s = String(s == null ? "" : s); + return s.replace(/&(?!\w+;)|["<>\\]/g, function(s) { switch(s) { case "&": return "&"; case "\\": return "\\\\";;