JavaScript: Difference between revisions

From IndieWeb
m ([tantek] added "Great flowchart explaining why the "Everyone has JS" assertion from modern webdevs is often false for a variety of reasons: https://kryogenix.org/code/browser/everyonehasjs.html" to "See Also")
m ([tantek] added "Criticism: More JS, More multiplicative risks: thread: https://twitter.com/slightlylate/status/1592834631468220417" to "See Also")
Line 77: Line 77:
** "I saw there was some discussion on here last week about how we shouldn't celebrate developers who don't know how the whole system works, end-to-end. 🧵/1" [https://twitter.com/bengoodger @bengoodger] November 30, 2021
** "I saw there was some discussion on here last week about how we shouldn't celebrate developers who don't know how the whole system works, end-to-end. 🧵/1" [https://twitter.com/bengoodger @bengoodger] November 30, 2021
* Great flowchart explaining why the "Everyone has JS" assertion from modern webdevs is often false for a variety of reasons: https://kryogenix.org/code/browser/everyonehasjs.html
* Great flowchart explaining why the "Everyone has JS" assertion from modern webdevs is often false for a variety of reasons: https://kryogenix.org/code/browser/everyonehasjs.html
* Criticism: More JS, More multiplicative risks: thread: https://twitter.com/slightlylate/status/1592834631468220417
** "I need to blog about the Principle of Minimal Client Complexity, but one way to understand why I push back so hard on huge stacks of JS is that when you move thing to the client, you don't add risks from each uncontrolled dimension, you _multiply_ them.<br><br>What are those risks?" [https://infrequently.org/ @slightlylate] November 16, 2022

Revision as of 07:42, 21 November 2022


JavaScript (JS) is a popular programming language due to its nearly ubiquitous availability in web browsers, and growing web server availability in the form of node.js.

Libraries

Generally useful libraries being developed by IndieWeb participants that run in Javascript:

Criticism

Sites break without Javascript

Javascript seems to have engendered web development methodologies that depend on it. Many sites seem to break without it, become inaccessible.

Although it is unlikely that visitors of your site still use a browser that does not support javascript as a technology, there are situations in which this is relevant to you as a webmaster.

See also: antipatterns

More Fragile Than HTML

Many sites now depend on Javascript to generate the page in a browser, rather than generating the page on the server and sending HTML. This is a more fragile approach:

Breaks Browser User Features

JS breaks links in new tab

As illustrated by: https://twitter.com/gabrielgironda/status/721115498474270721

DEAR #FRONTEND DEVELOPERS: PLEASE STOP MAKING SITES WITH LINKS I CAN'T COMMAND-CLICK TO OPEN IN A NEW TAB. WHAT IS WRONG WITH YOU

JS breaks form submission UI

As described by “Modern” web design antipatterns:

I press Enter, and nothing happens. So I click the submit button – which is, as it turns out, a <div> with attached JavaScript. That JavaScript changes the <div> text to “please wait…” and then it sends off an asynchronous API request. When it gets the response from the server, it then changes the location URL in my browser.

Congratulations on reimplementing <form> the long way around!

JS breaks select menu keyboard UI

Ibid:

I clicked on it, and tried typing “wa” – and nothing worked. It didn’t jump down to “Washington.” It didn’t even jump to “Washington” then back to “Alaska.” Oh, and of course cursor keys didn’t work either – I had to use my mouse to scroll and click and this hurts my wrist and is slow and error-prone. […]

Because it turns out that the dropdown box, rather than being a <select>, was a fucking <div> with JavaScript to set the value. And doesn’t have any keyboard access. For bonus points, they invented some HTML tags like <dropdown> to contain it. Why?! Standards exist for a reason!

Can Encourage Bad Engineering

A smiling guy labeled DEVELOPERS wearing an untucked light blue polo shirt and teal pants pouring a massive jug (the size of his torso) of olive oil labeled JAVASCRIPT into a medium sized bowl of salad labeled WEBSITE

As summarized by: https://twitter.com/fox/status/716879915333750784

I have seen the worst engineering in my career lately and I have one message:

STOP TRYING TO WRITE EVERYTHING FRONT-END IN JAVASCRIPT

Instead: Use JavaScript only for progressive enhancement.

See Also