aboutsummaryrefslogtreecommitdiffstats
path: root/src/dom.js
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2021-02-05 15:25:50 +0000
committers-ol <s-ol@users.noreply.github.com>2021-02-05 15:25:50 +0000
commite5e73c78f04015c99536bce368a2330f297f4afe (patch)
tree05bd064a700ebe72dc428ea57515f38105f9a05c /src/dom.js
parentlazy-load graph.json (diff)
downloadfedidag-e5e73c78f04015c99536bce368a2330f297f4afe.tar.gz
fedidag-e5e73c78f04015c99536bce368a2330f297f4afe.zip
react-ify
Diffstat (limited to 'src/dom.js')
-rw-r--r--src/dom.js42
1 files changed, 0 insertions, 42 deletions
diff --git a/src/dom.js b/src/dom.js
index dd15902..45f8a7a 100644
--- a/src/dom.js
+++ b/src/dom.js
@@ -11,45 +11,3 @@ export const css = ([ code] ) => {
return style;
};
-
-const appendChild = (parent, child) => {
- if (child === null || child === undefined || child === false)
- return;
-
- if (Array.isArray(child)) {
- child.forEach((nestedChild) => appendChild(parent, nestedChild));
- } else {
- parent.appendChild(child.nodeType ? child : document.createTextNode(child));
- }
-}
-
-const objectProps = { style: true, dataset: true };
-
-export const createElement = (tag, props, ...children) => {
- if ('function' === typeof tag)
- return tag(props, children);
-
- const element = document.createElement(tag);
-
- for (const [name, value] of Object.entries(props || {})) {
- if (name.startsWith('on') && name.toLowerCase() in window) {
- element.addEventListener(name.toLowerCase().substr(2), value);
- } else if (name === 'css') {
- for (const [prop, val] of Object.entries(value)) {
- element.style.setProperty(prop, val);
- }
- } else if (objectProps[name]) {
- Object.assign(element[name], value);
- } else {
- element.setAttribute(name, value.toString());
- }
- }
-
- for (const child of children) {
- appendChild(element, child);
- }
-
- return element;
-}
-
-export const createFragment = (props, ...children) => children;