31 lines
743 B
JavaScript
31 lines
743 B
JavaScript
((global) => {
|
|
|
|
function createElement(tagName, attributes, text) {
|
|
var element = document.createElement(tagName);
|
|
var attrs = attributes || {};
|
|
var keys = Object.keys(attrs);
|
|
|
|
for (var i = 0; i < keys.length; i += 1) {
|
|
element.setAttribute(keys[i], attrs[keys[i]]);
|
|
}
|
|
|
|
if (text !== undefined && text !== null) {
|
|
element.textContent = text;
|
|
}
|
|
|
|
return element;
|
|
}
|
|
|
|
function appendChildren(parent, children) {
|
|
for (var i = 0; i < children.length; i += 1) {
|
|
parent.appendChild(children[i]);
|
|
}
|
|
}
|
|
|
|
global.Y2KDom = {
|
|
createElement: createElement,
|
|
appendChildren: appendChildren
|
|
};
|
|
|
|
})(window);
|