For several years, I've been mostly against event handling code in HTML attributes. And for the longest part, it really was a terrible idea. With modules alone, it becomes really hard for onclick handlers to call code. Not without polluting the global namespace, at least. But now I'm starting to warm up to them again: thanks to custom elements, code can live in modules and still be triggered via DOM attributes, by using custom elements as the interface: <custom-element> <button onclick= "this.closest('custom-element').doThings()" > Click Me! </button> </custom-element> Enter fullscreen mode Exit fullscreen mode The actual logic, the doThings method, still lives in a separate model decoupled from the goings on of the DOM, and yet the button can cause it to run without needing any additional JavaScript to connect the two. The DOM is what connects the elements, which is exactly how it should be.…