this post was submitted on 08 Sep 2023
546 points (94.2% liked)
Programmer Humor
19623 readers
26 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Because it's just not very useful in some contexts. I've seen web extensions which mostly query the current page, and it doesn't render much or even anything.
Not all pages are SPAs either. Many apps are the old request-response with some dynamic behavior sprinkled on top. jQuery covers that well.
This model is also quite compatible with the rising HTMX where the state/rendering is driven from backend and you just insert few dynamic pieces with JS.
There's no difference between
document.querySelector("#element")
anddocument.getElementById("element")
, they're both same level clunky.Also, what you wrote is not functionally identical.
$el.show()
is idempotent, theel.toggle("hidden")
is not (as the name suggests, it toggles a class). It also needs an extra boilerplate class.There are plenty of non-professionals doing web stuff and I think it's great!
jQuery is 24 KiBs (minified, gzipped), that's a good price for the egonomics it provides. If you're constrained, there are API-compatible alternatives like cash which go down to 6KiBs.