EndTag: function(tag) { var element = this.elementStack.pop(); var parent = this.currentElement(); if (element.tag !== tag.tagName) { throw new Error("Closing tag " + tag.tagName + " did not match last open tag " + element.tag); } if (element.tag.indexOf("-") === -1) { appendChild(parent, element); } else { var program = new ProgramNode(element.children, { left: false, right: false }); postprocessProgram(program); var component = new ComponentNode(element.tag, element.attributes, program); appendChild(parent, component); } }
mustache: function(mustache) { var state = this.tokenizer.state; var token = this.tokenizer.token; switch(states[state]) { case "before-attr": this.tokenizer.state = 'attributeValueUnquoted'; token.addToAttributeValue(mustache); return; case "attr": token.addToAttributeValue(mustache); return; case "in-tag": token.addTagHelper(mustache); return; default: appendChild(this.currentElement(), mustache); } },
Chars: function(token) { var current = this.currentElement(); var text = new TextNode(token.chars); appendChild(current, text); },