by OkayPhysicist
1 subcomments
- This is remarkably useful. Even ignoring the built-in commands (which are handy in their own right), I find the button's action being self-described in the html ("tell this element to do this") far more pleasant to read than the normal see button -> /document.getElementById("buttonID") -> scroll back up to the html to figure out what elements are referred to in the script.
- I just noticed, that Invoker Commands are available across all major browsers. Good to see that HTML progresses to make Javascript redundant for basic UX.
by gorgoiler
1 subcomments
- I’ve been adding global listeners for click and keydown that call handleFoo(event) if event.target has a data-foo attribute.
The Invoker API seems like a neater way of handling the same pattern but I’m biased towards global event listeners because they work automatically on newly injected markup and they scale O(functionality) as opposed to per element listeners that scale O(elements). I’ll be the first to admit that the latter is more of an aesthetic choice rather than being based on any kind of performance statistics.
- Oh awesome. I wanted to use this last year but safari hadn't shipped support yet and I hit some problem with the polyfill.
Looks like safari shipped support in December though so now I can go nuts
- I don't get it. They say it doesn't need JavaScript. But how command is declared? And they show example rotating img with JS
- nice, htmx is infiltrating into the browser standards
by mock-possum
0 subcomment
- This is fine.
We’ve already had it as `label for=“form-element-id”`