Hey Riccardo,
You're 100% right that the id is the reason this is triggering more
than once. However, if you were actually replacing the button, it
would not do this.
The reason this is happening is because the `Replace` JsCmd
eagerly handles the HTML that is passed to it. “Handling” in this
case involves extracting event handlers so they can be attached
without including them in the HTML directly (so that strict content
security policy can be applied). This extraction is done when the
JsCmd is converted to a JavaScript string, but due to the way
that `toJsCmd` is defined for `Replace`, this is done eagerly when
it is instantiated, rather than being done only if the command is
used.
I think we can change the way that this is handled a little bit so
that it isn't a problem, and I think this is worth blocking a release
on as it's a fair assumption that this would work the way that it
is currently written.
Can you please file an issue for it on the lift/framework repo?
Thanks,
Antonio