Open propi opened 5 years ago
I recently announced LatestEvent.scala, which can be used for handling events.
Something like this would work
def view: Binding[Div] = {
val topMenuBar = html"<top-menu-bar></top-menu-bar>"
Binding {
LatestEvent.click(topMenuBar.bind).bind
// some action here
}.bind
html"<div>$topMenuBar</div>"
}
Hi,
in my web page, I use HTML custom tags and shadow DOM. I would like to use Binding.scala to render contents with bindings, but I have problem to add event handlers into custom tags.
In native JavaScript I have defined custom tag
<top-menu-bar>
. In Scala.js I have written this code:Unfortunately, the compiler returns
type mismatch
If the attribute is without the
data:
prefix, it also does not work becausevalue onclick is not a member of org.scalajs.dom.raw.Element
Is it possible to add an event handler to a custom tag?