UNPKG

1.72 kBJavaScriptView Raw
1"use strict";
2function createElement(tagName) {
3 return document.createElement(tagName);
4}
5function createElementNS(namespaceURI, qualifiedName) {
6 return document.createElementNS(namespaceURI, qualifiedName);
7}
8function createTextNode(text) {
9 return document.createTextNode(text);
10}
11function createComment(text) {
12 return document.createComment(text);
13}
14function insertBefore(parentNode, newNode, referenceNode) {
15 parentNode.insertBefore(newNode, referenceNode);
16}
17function removeChild(node, child) {
18 node.removeChild(child);
19}
20function appendChild(node, child) {
21 node.appendChild(child);
22}
23function parentNode(node) {
24 return node.parentNode;
25}
26function nextSibling(node) {
27 return node.nextSibling;
28}
29function tagName(elm) {
30 return elm.tagName;
31}
32function setTextContent(node, text) {
33 node.textContent = text;
34}
35function getTextContent(node) {
36 return node.textContent;
37}
38function isElement(node) {
39 return node.nodeType === 1;
40}
41function isText(node) {
42 return node.nodeType === 3;
43}
44function isComment(node) {
45 return node.nodeType === 8;
46}
47exports.htmlDomApi = {
48 createElement: createElement,
49 createElementNS: createElementNS,
50 createTextNode: createTextNode,
51 createComment: createComment,
52 insertBefore: insertBefore,
53 removeChild: removeChild,
54 appendChild: appendChild,
55 parentNode: parentNode,
56 nextSibling: nextSibling,
57 tagName: tagName,
58 setTextContent: setTextContent,
59 getTextContent: getTextContent,
60 isElement: isElement,
61 isText: isText,
62 isComment: isComment,
63};
64Object.defineProperty(exports, "__esModule", { value: true });
65exports.default = exports.htmlDomApi;
66//# sourceMappingURL=htmldomapi.js.map
\No newline at end of file