Allow ids to contain hyphens. Fixes #36.
Previously, a mustache like {{foo-bar}} would generate a
parse error, which was a departure from the behavior of
other Mustache implementations.
This commit is contained in:
@@ -273,7 +273,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]) {
|
||||
if(JavaScriptCompiler.RESERVED_WORDS[name] || name.indexOf('-') !== -1) {
|
||||
return parent + "['" + name + "']";
|
||||
} else {
|
||||
return parent + "." + name;
|
||||
|
||||
Reference in New Issue
Block a user