aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/xeact/jsx-runtime.js
blob: 58ccfaa87368f426ec47a1186d0399ac1de891e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { h } from './xeact.ts';

/**
 * Create a DOM element, assign the properties of `data` to it, and append all `data.children`.
 *
 * @type{function(string, Object=): HTMLElement}
 */
export const jsx = (tag, data) => {
  let children = data.children;
  delete data.children;
  const result = h(tag, data, children);
  result.classList.value = result.class;
  return result;
};
export const jsxs = jsx;
export const jsxDEV = jsx;