class that builds html in javascript
//html body Object
var HtmlBuilder = (function(){
function HtmlBuilder(){
this.head = [];
this.body = [];
}
HtmlBuilder.prototype.getBody = function(){
return "<body>\n" + this.body.join("") + "</body>";
};
HtmlBuilder.prototype.appendBody = function(element){
this.body.push(element);
};
HtmlBuilder.prototype.getHead = function(){
return "<head>\n" + this.head.join("") + "</head>\n";
};
HtmlBuilder.prototype.getDocument = function(){
return "<!DOCTYPE html>\n" + "<html>\n" + this.getHead() + this.getBody() + "</html>";
};
return HtmlBuilder;
})();