OvermindDL1 / bucklescript-tea

TEA for Bucklescript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing HTML tags compared to Elm

soren-n opened this issue · comments

Currently prototyping with Bucklescript TEA for a project, love it so far :)
But came across that iframes are currently not defined in the HTML module.

I cross-referenced Elm's HTML docs with the definitions in tea_html.ml, and found a small handful of tags, these were then cross-referenced against w3school's list of tags.

These are the tags I found, the scratched tags are ones that Elm defined but I could find on w3schools' list:

hr, blockquote,
code, em, b, u, sub, sup,
dl, dt, dd,
iframe, canvas, math,
address,
caption, colgroup, col,
fieldset, legend, datalist, optgroup, keygen, output, meter,
audio, video, source, track,
embed, object, param,
ins, del,
small, cite, dfn, abbr, var, samp, kbd, s, q,
ruby, rt, rp, bdi, bdo, wbr, menuitem, menu

I am posting this issue since I am not sure how else to generate these missing tags without modifying the TEA source code, and if I am to do this, then I would rather do this proper and make it into a pull-request.

If there is a better way, then I would love to hear it :)

Yeah I've tended to only add ones that I've actively used often enough to warrant me adding them. ^.^;

It's pretty trivial to add more in https://github.com/OvermindDL1/bucklescript-tea/blob/master/src/tea_html.ml by adding new lines of the form of:

let div ?(key="") ?(unique="") props nodes = fullnode "" "div" key unique props nodes

You can always use the fullnode call in your own code to use whatever you wish (like custom elements! ^.^).

I'll leave this open to use as a convenient list for me to add them later (issues make great todo lists!), but otherwise feel free to add them yourself via a PR (and add yourself to the CONTRIBUTORS.md file), otherwise I'll get to it sometime. :-)

As for the ones that are not on w3schools (if you are curious why):

  • math: Not part of the HTML spec, but rather is part of the Web.MathML spec, so it should probably be in it's own separate file like SVG is.
  • keygen: This is an old antiquated call that was removed in the HTML5 standard (I honestly thought it was a good idea to keep it, maybe update it a touch, but eh...).
  • ruby: I don't know why w3schools wouldn't have this, it is a full-fledge HTML5 element.

Even then, custom elements means that potentially any name is usable (even though custom elements are 'supposed' to have at least one dash in them) so you eventually end up having to use fullnode or node at times anyway. :-)

Vdom.fullnode

Yep, or the shortcut node in the Html module. :-)

Closed in #67