更新craeteElement,自動將建立的元件加入到parent。
===
var common = {};
common.createElement = function (tag, attributes, parent) {
var element = document.createElement(tag);
for (var attribute of attributes) {
element.setAttribute(attribute, attributes[attribute]);
}
if (parent !== undefined) {
parent.appendChild(element);
}
return element;
};
===.