summaryrefslogtreecommitdiffstats
path: root/lib/handlebars
diff options
context:
space:
mode:
Diffstat (limited to 'lib/handlebars')
-rw-r--r--lib/handlebars/compiler.js2
-rw-r--r--lib/handlebars/utils.js9
2 files changed, 7 insertions, 4 deletions
diff --git a/lib/handlebars/compiler.js b/lib/handlebars/compiler.js
index 4be85f4..f3ce602 100644
--- a/lib/handlebars/compiler.js
+++ b/lib/handlebars/compiler.js
@@ -288,7 +288,7 @@ Handlebars.JavaScriptCompiler = function() {};
// PUBLIC API: You can override these methods in a subclass to provide
// alternative compiled forms for name lookup and buffering semantics
nameLookup: function(parent, name, type) {
- if(JavaScriptCompiler.RESERVED_WORDS[name] || name.indexOf('-') !== -1) {
+ if(JavaScriptCompiler.RESERVED_WORDS[name] || name.indexOf('-') !== -1 || !isNaN(name)) {
return parent + "['" + name + "']";
} else if (/^[0-9]+$/.test(name)) {
return parent + "[" + name + "]";
diff --git a/lib/handlebars/utils.js b/lib/handlebars/utils.js
index e7e5043..5fdfb0e 100644
--- a/lib/handlebars/utils.js
+++ b/lib/handlebars/utils.js
@@ -16,11 +16,14 @@ Handlebars.SafeString.prototype.toString = function() {
(function() {
var escape = {
"<": "&lt;",
- ">": "&gt;"
+ ">": "&gt;",
+ '"': "&quot;",
+ "'": "&#x27;",
+ "`": "&#x60;"
};
- var badChars = /&(?!\w+;)|[<>]/g;
- var possible = /[&<>]/;
+ var badChars = /&(?!\w+;)|[<>"'`]/g;
+ var possible = /[&<>"'`]/;
var escapeChar = function(chr) {
return escape[chr] || "&amp;"