fixed html builder component

This commit is contained in:
Borys Levytskyi
2015-04-02 23:14:54 +03:00
parent cadafab3ec
commit 5ca01bb0de
3 changed files with 61 additions and 108 deletions

View File

@@ -4,9 +4,20 @@
this.sb = [];
}
HtmlBuilder.prototype.element = function(tagName, arg) {
var attrs = typeof arg == "object" ? arg : { html: arg},
elementContent = attrs.html || '';
HtmlBuilder.prototype.element = function(tagName, arg1, arg2) {
var attrs, elementContent;
if(typeof arg1 == "object") {
attrs = arg1;
}
else if(typeof arg1 == "string") {
attrs = { html: arg1 };
}
else {
attrs = {};
}
elementContent = attrs.html || arg2;
this.sb.push('<' + tagName + ' ' + getAttributesStr(attrs) + ">");