You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.0 KiB
JavaScript
55 lines
1.0 KiB
JavaScript
9 years ago
|
function createElement(tagName){
|
||
|
return document.createElement(tagName);
|
||
|
}
|
||
|
|
||
|
function createElementNS(namespaceURI, qualifiedName){
|
||
|
return document.createElementNS(namespaceURI, qualifiedName);
|
||
|
}
|
||
|
|
||
|
function createTextNode(text){
|
||
|
return document.createTextNode(text);
|
||
|
}
|
||
|
|
||
|
|
||
|
function insertBefore(parentNode, newNode, referenceNode){
|
||
|
parentNode.insertBefore(newNode, referenceNode);
|
||
|
}
|
||
|
|
||
|
|
||
|
function removeChild(node, child){
|
||
|
node.removeChild(child);
|
||
|
}
|
||
|
|
||
|
function appendChild(node, child){
|
||
|
node.appendChild(child);
|
||
|
}
|
||
|
|
||
|
function parentNode(node){
|
||
|
return node.parentElement;
|
||
|
}
|
||
|
|
||
|
function nextSibling(node){
|
||
|
return node.nextSibling;
|
||
|
}
|
||
|
|
||
|
function tagName(node){
|
||
|
return node.tagName;
|
||
|
}
|
||
|
|
||
|
function setTextContent(node, text){
|
||
|
node.textContent = text;
|
||
|
}
|
||
|
|
||
|
module.exports = {
|
||
|
createElement: createElement,
|
||
|
createElementNS: createElementNS,
|
||
|
createTextNode: createTextNode,
|
||
|
appendChild: appendChild,
|
||
|
removeChild: removeChild,
|
||
|
insertBefore: insertBefore,
|
||
|
parentNode: parentNode,
|
||
|
nextSibling: nextSibling,
|
||
|
tagName: tagName,
|
||
|
setTextContent: setTextContent
|
||
|
};
|