bs-webapi-incubator
bs-webapi-incubator copied to clipboard
Classify for Dom.node
Something like Js.Json.classify
and Js.Types.classify
but for Dom.node
s
It would be based on similar tags as https://github.com/reasonml-community/bs-webapi-incubator/blob/master/src/Webapi/Webapi__Dom/Webapi__Dom__Types.re#L177-L190
But parameterized, ie:
type t =
| Element of Dom.element
| Text of Dom.text
...
let classify (node: Dom.node) : t = ...
Not sure if you're asking for my approval of this, but if you are: I approve!
Yeah, but also just adding it here so I don't forget about it. I'm not sure when I'd be able to work on this
@Risto-Stevcev if you are planning to use instanceof
, note that it's tricky because different windows have different prototype chains and instanceof
doesn't work across windows. This will need to be accounted for. See e.g. https://github.com/reasonml-community/bs-webapi-incubator/blob/aad089aa2cd93e8884f53afb2507c2321265ff46/src/Webapi/Webapi__Dom/Webapi__Dom__Element.re#L8
Thanks for the heads up @yawaramin 🙂