aboutsummaryrefslogtreecommitdiff
path: root/thirdparty/preact/src/h.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-11-13 08:16:12 +0100
committerFlorian Dold <florian.dold@gmail.com>2016-11-13 08:16:52 +0100
commitb2128609ac8159a14224deba399144b3400c8c20 (patch)
tree4759dfda67c54f6838c3aef0951545ae18bb83bd /thirdparty/preact/src/h.js
parent3f0ee289c4a61991d0e75906a9bd949cebb39d20 (diff)
downloadwallet-core-b2128609ac8159a14224deba399144b3400c8c20.tar.xz
Finally give in and use React, minor tweeks.
Preact (a minimalistic React alternative) had too many bugs ...
Diffstat (limited to 'thirdparty/preact/src/h.js')
-rw-r--r--thirdparty/preact/src/h.js50
1 files changed, 0 insertions, 50 deletions
diff --git a/thirdparty/preact/src/h.js b/thirdparty/preact/src/h.js
deleted file mode 100644
index c137bec84..000000000
--- a/thirdparty/preact/src/h.js
+++ /dev/null
@@ -1,50 +0,0 @@
-import { VNode } from './vnode';
-import options from './options';
-
-
-const stack = [];
-
-
-/** JSX/hyperscript reviver
-* Benchmarks: https://esbench.com/bench/57ee8f8e330ab09900a1a1a0
- * @see http://jasonformat.com/wtf-is-jsx
- * @public
- * @example
- * /** @jsx h *\/
- * import { render, h } from 'preact';
- * render(<span>foo</span>, document.body);
- */
-export function h(nodeName, attributes) {
- let children = [],
- lastSimple, child, simple, i;
- for (i=arguments.length; i-- > 2; ) {
- stack.push(arguments[i]);
- }
- if (attributes && attributes.children) {
- if (!stack.length) stack.push(attributes.children);
- delete attributes.children;
- }
- while (stack.length) {
- if ((child = stack.pop()) instanceof Array) {
- for (i=child.length; i--; ) stack.push(child[i]);
- }
- else if (child!=null && child!==false) {
- if (typeof child=='number' || child===true) child = String(child);
- simple = typeof child=='string';
- if (simple && lastSimple) {
- children[children.length-1] += child;
- }
- else {
- children.push(child);
- lastSimple = simple;
- }
- }
- }
-
- let p = new VNode(nodeName, attributes || undefined, children);
-
- // if a "vnode hook" is defined, pass every created VNode to it
- if (options.vnode) options.vnode(p);
-
- return p;
-}