The upcoming Invoker Commands API introduces a new way to invoke JavaScript events on elements through buttons. Of course, this was already possible so let me explain the difference.
Traditionally, you would:
This new Invoker Command API lets you skip all three steps by introducing two new HTML attributes to the HTML button element:
commandfor | Turns a button element into a button, controlling the given interactive element; takes the ID of the element to control as its value. | command | Specifies the action to be performed on an element being controlled |
Providing arguments to the invoked action is also possible. This does require setting up an event listener but with a major improvement over the traditional way: the event listener is added to the manipulated element instead of to the buttons.