Open
Description
Would it be possible to add a method to IsElement
for getting the element's tag? This would allow for safer element construction. I've ended up implementing this downstream, but it'd be tedious to do for the entire API:
createElementTyped :: forall a. (IsElement' a, PFromJSVal a) => Document -> JSM a
createElementTyped doc = unsafeCastTo pFromJSVal =<< createElement doc (elementTag @a)
class (IsElement a) => IsElement' a where
elementTag :: Text
instance IsElement' HTMLCanvasElement where
elementTag = "canvas"
instance IsElement' HTMLImageElement where
elementTag = "img"
instance IsElement' HTMLLinkElement where
elementTag = "link"
Metadata
Assignees
Labels
No labels