Is it possible to create
val typedTag: TypedTag[Div] = div("abc")
val d: Div = typedTag.render
//somwhere `type Div = raw.HTMLDivElement`
Sadly, no -- that doesn't actually make any sense if you think it through, at least not that way. The thing is, a
TypedTag isn't an HTML element, it's something that builds an HTML element. By contrast, the
HTMLElement is an actual element. So basically, you're trying to get a bag of cocoa powder from an already-mixed cup.
I suspect it would be possible to build what you're asking for, but it would be a bit involved -- you'd have to build something that takes an
HTMLElement and maps back to a
TypedTag parameterized for that element type, then work with the
TypedTag, render it and replace the existing
HTMLElement in-page. It could be done, but I suspect it's more work than it's worth...