Test the parser, and clean up ID having multiple parts

This commit is contained in:
wycats
2010-11-25 23:32:03 -08:00
parent f8b245896d
commit b401fc388b
4 changed files with 177 additions and 5 deletions
+15 -2
View File
@@ -30,9 +30,22 @@ Handlebars.AST.ContentNode = function(string) {
this.string = string;
}
Handlebars.AST.IdNode = function(id) {
Handlebars.AST.IdNode = function(parts) {
this.type = "ID"
this.id = id;
this.parts = parts;
var dig = [], depth = 0;
for(var i=0,l=parts.length; i<l; i++) {
var part = parts[i];
if(part === "..") { depth++; }
else if(part === "." || part === "this") { break; }
else { dig.push(part) }
}
this.dig = dig;
this.depth = depth;
}
Handlebars.AST.StringNode = function(string) {