Invoker Commands API

(developer.mozilla.org)

44 points | by maqnius 3 days ago ago

8 comments

  • wild_egg 5 minutes ago

    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

  • OkayPhysicist 41 minutes ago

    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.

    • sheept 36 minutes ago

      To be fair, there's little stopping you from putting the button action in its onclick attribute.

      I guess the stylistic choice of separating content, style, and interactivity eventually became a convention to keep JavaScript isolated from HTML, but nowadays with Tailwind and HTMX, it does seem like at least some developers want everything in HTML, for the strengths you mentioned.

  • maqnius 3 days ago

    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.

    • masfuerte an hour ago

      I've always browsed with javascript disabled but in the last few months (presumably in response to AI scraping) loads of sites that previously worked now don't. IMDB. Loads of open-source blogs, wikis and source repositories. Commenting on Wikipedia. Browsing job sites.

      It's never been easier to create a great site that doesn't require javascript, but hardly anyone is.

      • Waterluvian 42 minutes ago

        I think there’s a lot of good reasons to, but hardly any incentive to.

        People who disable JS are probably a very tiny minority and of those who consume ads, an even smaller one.

  • gitowiec 2 days ago

    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