Skip to content

Instantly share code, notes, and snippets.

@gamebox
Created July 18, 2020 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gamebox/23f02739d9f62f84a8f1fb0f4bd40a29 to your computer and use it in GitHub Desktop.
Save gamebox/23f02739d9f62f84a8f1fb0f4bd40a29 to your computer and use it in GitHub Desktop.
const h = (type) => (props, children = [], node, tag) => ({
type,
props,
children: Array.isArray(children) ? children : [children],
node,
key: props.key,
tag,
})
export default {
a: h("a"),
b: h("b"),
i: h("i"),
p: h("p"),
q: h("q"),
s: h("s"),
u: h("u"),
br: h("br"),
dd: h("dd"),
dl: h("dl"),
dt: h("dt"),
em: h("em"),
h1: h("h1"),
h2: h("h2"),
h3: h("h3"),
h4: h("h4"),
h5: h("h5"),
h6: h("h6"),
hr: h("hr"),
li: h("li"),
ol: h("ol"),
rp: h("rp"),
rt: h("rt"),
td: h("td"),
th: h("th"),
tr: h("tr"),
ul: h("ul"),
bdi: h("bdi"),
bdo: h("bdo"),
col: h("col"),
del: h("del"),
dfn: h("dfn"),
div: h("div"),
img: h("img"),
ins: h("ins"),
kbd: h("kbd"),
map: h("map"),
nav: h("nav"),
pre: h("pre"),
rtc: h("rtc"),
sub: h("sub"),
sup: h("sup"),
svg: h("svg"),
wbr: h("wbr"),
abbr: h("abbr"),
area: h("area"),
cite: h("cite"),
code: h("code"),
data: h("data"),
form: h("form"),
main: h("main"),
mark: h("mark"),
menu: h("menu"),
ruby: h("ruby"),
samp: h("samp"),
span: h("span"),
time: h("time"),
aside: h("aside"),
audio: h("audio"),
embed: h("embed"),
input: h("input"),
label: h("label"),
meter: h("meter"),
param: h("param"),
small: h("small"),
table: h("table"),
tbody: h("tbody"),
tfoot: h("tfoot"),
thead: h("thead"),
track: h("track"),
video: h("video"),
button: h("button"),
canvas: h("canvas"),
dialog: h("dialog"),
figure: h("figure"),
footer: h("footer"),
header: h("header"),
iframe: h("iframe"),
legend: h("legend"),
object: h("object"),
option: h("option"),
output: h("output"),
select: h("select"),
source: h("source"),
strong: h("strong"),
address: h("address"),
article: h("article"),
caption: h("caption"),
details: h("details"),
section: h("section"),
summary: h("summary"),
picture: h("picture"),
colgroup: h("colgroup"),
datalist: h("datalist"),
fieldset: h("fieldset"),
menuitem: h("menuitem"),
optgroup: h("optgroup"),
progress: h("progress"),
textarea: h("textarea"),
blockquote: h("blockquote"),
figcaption: h("figcaption")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment