UNPKG

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