News for hackers. Stuff that matters.
Re:jQuery v4.0 Beta by ecshafer on Tuesday February 06, 2024 @10:02PM (#39283942)
Also, jQuery is awesome.

People have been in love with the overly complex and fancy javascript frameworks for the last 15 years or so. But jQuery doing dynamic binding to dynamically generated forms for some error states and maybe an ajax calls is literally all the javascript you need in 99% of web pages and the rest is overkill.

The industry is going to move away from the complexities to React and towards more of this simplicity with htmx, phoenix live view, ruby on rails turbo, and yes just jQuery.

Re:jQuery v4.0 Beta by tipiirai on Tuesday February 06, 2024 @10:20PM (#39284047)
Second to that: jQuery is awesome.

Or more specifically: the idea that websites can be built with vanilla HTML, CSS, and _optional_ JS. jQuery embraces progressive enhancement and separation of concerns pattern, which is quite the opposite of how websites are built these days. Web development starts with 10+ React import statements for components, CSS, images, and whatnot. JavaScript is a must, not optional.

Re:jQuery v4.0 Beta by nextaccountic on Tuesday February 06, 2024 @10:43PM (#39284213)
About optional JS: you can have that with server-side rendering plus a modern framework (like next.js or leptos). That's certainly not as simple as vanilla html and js, but totally doable.
Re:jQuery v4.0 Beta by tipiirai on Tuesday February 06, 2024 @10:49PM (#39284268)
You sure can, but it then comes to the separation of concerns. CSS-in-JS (coupling of concerns) is the preferred option.
Re:jQuery v4.0 Beta by teaearlgraycold on Tuesday February 06, 2024 @11:34PM (#39284533)
Having CSS in a separate file feels like defining the predicates for your if statements in a separate file. With tailwind we're getting pretty close to a great solution here.
Re:jQuery v4.0 Beta by kkarpkkarp on Wednesday February 07, 2024 @02:08AM (#39285473)
> you can have that with server-side rendering plus

yes, we use PHP for this which is much simpler to grasp than JS-SSR

Re:jQuery v4.0 Beta by wouldbecouldbe on Wednesday February 07, 2024 @02:45AM (#39285706)
Nah, not simpler, nextjs is simpler then php to start working with. Also running & deploying nowadays is easier. PHP used to be easiest, but fell behind.
Re:jQuery v4.0 Beta by pzmarzly on Wednesday February 07, 2024 @05:09AM (#39286669)
This very much depends on what you are building and how experienced you are.

If you just want a few pages, no need for background workers or database migrations, PHP is still the king. You download one of many single-executable LAMP servers, and start writing your index.php. Deploy? Just copy files to server. Zero downtime deploy? Copy files to server and use symlink to atomically switch versions. Dependencies? Composer (package manager) is a single-file script, you can place it wherever. Pain only begins when you want to break away from file-based routing, or need custom .htaccess and nginx.conf, or want to isolate components, or need Redis and cron for background jobs.

On NextJS side, I knew a few people who wanted to start their career with it and the experience wasn't smooth. You install nodejs... but your distribution only ships Node 12, so everything is failing with cryptic errors. You search how to upgrade Node, and get caught in nvm vs n vs asdf flamewars. Once you found a working solution (which probably required you to edit env variables), you run the npm command... and it wants root access? To install packages system-wide? So you google around, find a way to make it use the user home directory. Then you are up and running, you aren't sure what this "React" thing is, but you get stuff done. Time to deploy - and you are told to either learn Docker (and Kubernetes if you want zero downtime), or to use one of few hosting companies with a price markup. Well, at least there is a free tier (for now), so most people choose the latter. Was this a simple start?

Now, when it comes to big apps, I'd very much rather use Nextjs than PHP, it is production-tested, gives you a lot "for free", JS LSP is built-in to VSCode, I already know React and most of JS ecosystem. But if somebody tells me that they just finished learning HTML and vanilla JS, and they want to do something simple server-side, I'm torn on what to recommend nowadays.

Re:jQuery v4.0 Beta by wouldbecouldbe on Wednesday February 07, 2024 @05:54AM (#39286995)
You haven't worked with Vercel. Just connect your git account and you have a fully git-flow based server, with preview urls for every PR. Especially for small projects ideal.

Running it on a VPS is a skill on it's own, for both, if users had known to use NVM (which is explained in most top articles in Google) it would have not been a problem and if they don't know they should accept the learning pains of running productions apps (PHP, node or whatever), or otherwise use a managed service such as Vercel.

Upgrading PHP version is even more painful, I've tried to do version updates, and was alway easier just to build a new server. And also requires specific knowledge of apache, or nginx. Let alone deal with server outages, backups, restart, memory issues.

Re:jQuery v4.0 Beta by hu3 on Wednesday February 07, 2024 @08:42AM (#39288431)
> Upgrading PHP version is even more painful, I've tried to do version updates, and was alway easier just to build a new server.

I upgraded PHP 7.2 to 8.3 for a business client yesterday.

It was a CentOS VM.

It took maybe 5 commands, no server restart involved either.

I could barely bill an hour and that is because I kept tail -f their logs to see if everything went smooth. And it did.

How is that painful?

Re:jQuery v4.0 Beta by Capricorn2481 on Wednesday February 07, 2024 @10:19AM (#39289579)
This is just intellectually dishonest. It completely depends on whether your libraries have breaking changes and how your app is structured. Many legacy projects use old versions of ORMs and frameworks that don't support PHP 8. So now you're also upgrading code igniter and you're looking at hundreds of files that call it's ORM
Re:jQuery v4.0 Beta by hu3 on Wednesday February 07, 2024 @11:54AM (#39290905)
No. If we're talking about tech debt (that's not what parent was talking about by the way) then JS is a magnitude worse. Running old projects from JS ecosystem can require multiple miracles, not only code refactoring.

And your example, codeigniter, is one of the worst examples in PHP.

Not only it is a framework that has minor usage: https://trends.google.com/trends/explore?q=codeigniter,larav...

It is infamous for being hard to upgrade. No responsible PHP developer would start a complex project in it today.

A typical PHP project in the last years use either Laravel or Symfony.

Not to mention PHP has mature tooling to perform automated code upgrade between versions: https://github.com/rectorphp/rector

The project I mentioned was 4 years old and so far no code change was required between PHP 7.2 and PHP 8.3.

And again, my parent was clearly talking about server upgrade: "was alway easier just to build a new server".

And the change I had to do was not even multiple lines, it was a single line in a Dockerfile. I found the Pull Request and it was from 7.4 to 8.3:

https://i.imgur.com/MmemYSp.png

Re:jQuery v4.0 Beta by Capricorn2481 on Wednesday February 07, 2024 @01:38PM (#39292384)
Nobody said js wasn't worse, just that your experience is not the experience of most PHP upgrades.

Saying Code Igniter is not used in a lot of places because of Google trends is wrong for a lot of reasons, but the biggest of which being your graph shows laravel and codeigniter neck and neck a decade ago. Who cares whether new projects are started in code igniter? PHP is mostly legacy apps, and there are other frameworks with similar nightmare stories.

Again, JS is bad too, but we have to completely rewrite sites due to some PHP framework upgrades because PHP let's people do really dumb ORM templating.

I have no idea what you're referring to with your distinction between tech debt and server upgrades. I'm talking about server upgrades, clearly. I'm just saying if you upgrade PHP on an old project chances are things will break. This happens with Laravel and Slim too.

Re:jQuery v4.0 Beta by hu3 on Wednesday February 07, 2024 @06:54PM (#39295939)
> PHP let's people do really dumb ORM templating.

PHP has nothing to do with ORM problems. Any language allows dumb stuff related to ORM. Those are the libraries rather than the language.

PHP, like any language, has good and bad libraries.

If a project uses a bad solution for ORM, the language is not to blame.

I can do dumb ORM stuff in C#, Java, Rust, C++ and Python.

If a project picked a bad framework 10 years ago and now complains about the language instead of the framework I don't know what to tell you.

Re:jQuery v4.0 Beta by Capricorn2481 on Wednesday February 07, 2024 @08:28PM (#39296706)
Then it sounds like we disagree on what the thread is about. When I hear "I updated PHP and everything broke" I think "because libraries break between version upgrades." You seem to be arguing against a position that people aren't taking, which is that there's something inherently wrong with PHP as a language that makes it break when upgraded (which nobody has said).

The same goes for Node, which doesn't break servers just because you upgrade it. I have updated from 12 to 20 with no problems because of the dependencies.

Re:jQuery v4.0 Beta by hu3 on Thursday February 08, 2024 @07:08AM (#39301003)
How is this not a complain about the language?

> Again, JS is bad too, but we have to completely rewrite sites due to some PHP framework upgrades because PHP let's people do really dumb ORM templating.

I even quoted this part specifically in my reply:

> because PHP let's people do really dumb ORM templating.

Re:jQuery v4.0 Beta by Capricorn2481 on Sunday February 11, 2024 @12:01AM (#39332772)
You misunderstand me, I'm saying it has as much to do with PHP as it has to do with JS. Node doesn't break on upgrade because of JS, it breaks because of dependencies that don't work on new versions, as does PHP.
Re:jQuery v4.0 Beta by wouldbecouldbe on Wednesday February 07, 2024 @05:09PM (#39294955)
it was when I had to move php5 to php7 5-6 years back, and if I remember correctly a few OS libs didn't support php7 so that was really hard. Was faster to build a new VPS, since no big DB or storage was easier.

You might have had a smooth experience, and happy for you. But PHP didn't have, maybe it does now, such a good version manager as NVM.

But yeah we also had once where all the way back where we didn't do it with NVM and that was a pain in the ass.

Re:jQuery v4.0 Beta by viraptor on Wednesday February 07, 2024 @06:36AM (#39287283)
You normally want to see things locally as you develop them. Vercel is cool and all, but doing a git push and waiting for the build every time you want a refresh? Nah, that's not viable. And almost everything mentioned above for deployments applies to your own dev machine as well.
Re:jQuery v4.0 Beta by wouldbecouldbe on Wednesday February 07, 2024 @06:46AM (#39287354)
Okay then your comment is weird, windows & mac dont have distribution with node versions lower then LTS. It can be an issue on ubuntu/linux having an outdated registry. But nextjs clearly states minimum node version in their docs: https://nextjs.org/docs/getting-started/installation

And how to install every version you want NVM, that's on the user if it didn't work. That's not something different then can happen with PHP or other tools as mysql in the LAMP setup.

Re:jQuery v4.0 Beta by viraptor on Wednesday February 07, 2024 @06:44PM (#39295871)
The context here is the "starting with" situation. It's much easier to do that with PHP since you normally don't have to care about versions there - barely anything requires version higher than in LTS. On the other side it doesn't matter what is clearly documented, or which registry is up to date - a person looking at this for the first time is either going to have an easier life or not. Nextjs effectively has extra steps you need to know about and follow.
Re:jQuery v4.0 Beta by wouldbecouldbe on Thursday February 08, 2024 @05:26AM (#39300352)
that's simply not true. nodejs v12 is years old, its like using php5 and lots of platforms don't support 5 anymore.
Re:jQuery v4.0 Beta by viraptor on Thursday February 08, 2024 @05:50AM (#39300507)
Security support for node 12 ended in 2022. For php5, in 2018. Those are very different.

Rhel 7 is still alive, supports node 8, maybe 12, but nothing higher officially.

Re:jQuery v4.0 Beta by wouldbecouldbe on Sunday February 11, 2024 @01:42PM (#39337330)
Yeah that's more an issue with Rhel, but you can solve that easily with NVM https://tecadmin.net/install-nvm-centos-8/
Re:jQuery v4.0 Beta by bmelton on Wednesday February 07, 2024 @11:55AM (#39290916)
Why do you have to wait?

It's fairly normal to run some version of `npm run serve` with a filesystem watcher that will hot-reload changes as they occur so that you can see changes every time you hit :w (or CMD+S or whatever saves a file on your filesystem)

Re:jQuery v4.0 Beta by viraptor on Wednesday February 07, 2024 @06:47PM (#39295891)
The context is about the initial setup and the parent comment recommended vercel git flow. Yes, you can run it locally, but that's back to the "getting started" issues: https://news.ycombinator.com/item?id=39286669
Re:jQuery v4.0 Beta by wouldbecouldbe on Friday February 09, 2024 @06:28AM (#39313759)
You really think nextjs is difficult just because one person you knew had a very outdated nodejs version; it's really not.
Re:jQuery v4.0 Beta by bmelton on Friday February 09, 2024 @09:57AM (#39315414)
Okay. I think it's fair to say that if you don't install the tool you're developing in, it does make it much harder to work in locally.

That's equally true of PHP.

Moreover, it's equally true that distros aren't always shipping the latest PHP versions, and that there are similar flamewars surrounding phpenv/pvm as there are nvm/asdf. There are options, and people have opinions. The more ensconced one gets in an ecosystem, the more easy it is to know which tools offer which benefits relative to your needs. None of those decisions are easily made when new to an ecosystem -- Elixir is newish and has enough coalescence around most of the mainstream things, but as someone new to it, if I needed to choose between Cowboy and Bandit, I would have quite a bit of learning required upfront.

Re:jQuery v4.0 Beta by KronisLV on Wednesday February 07, 2024 @10:14AM (#39289529)
From where I stand, both of you have some good arguments, but in my eyes the technologies are similar enough for the differences not to matter too much.

I just use Docker for both local development and remote deployments, with bind mounts of source code when I'm working the code, sometimes with appropriate remote debugging set up. I don't even care that much about what packages or versions are available on my workstation OS, as long as Docker (or another OCI runtime like Podman) works. Same for external dependencies, like Redis, RabbitMQ, MariaDB/MySQL/PostgreSQL and so on, they can just be throwaway containers, or maybe something more persistent in a cloud deployment.

I can even start with an Alpine/Debian/Ubuntu/whatever base image and install the packages myself in whatever order I want, to use as a base image for all of my apps. And on the server, I can run whatever cluster I want, since Docker Swarm or Nomad will be way easier to use for most use cases than a full distro of Kubernetes (although K3s is fine). That takes care of scheduling, health checks, restarts, resource limits and reservations, storage, networking and a lot of other concerns.

I usually have some sort of a web server as a reverse proxy in front of everything anyways (Apache/Nginx/Caddy/Traefik/...), so it's no big deal to add a bit of configuration. Even on PHP side, setting up PHP-FPM is a few commands and any configuration for either is sufficient with either environment variables, or changing a few files. Maybe a Bash script for an entrypoint that does the setup for every container launch, based on the needed configuration.

As an aside, with Apache you often don't really need to use .htaccess since disabling it and using configuration files under sites-enabled is better for lower IO, much like Nginx, since you don't need to scan every directory to look for the file: https://httpd.apache.org/docs/current/howto/htaccess.html#wh...

Node is fine. I don't even need to use nvm locally, I can just have different base images for containers with different node versions and then easily check how easy it would be to carry all of my software over to something else (by swapping out the base image), without messing around with installing stuff manually. As for installing packages "globally"? Who cares, it's all inside of the container image anyways, so suddenly that distinction doesn't matter in the slightest.

I don't need any external services or PaaS providers, it's just a container that I can run on pretty much any VPS host and horizontally and vertically scale as far as I need. Regardless of whether inside of the container there's JS, PHP, Java, .NET, Ruby, Python or anything else. This is especially nice when I can use Woodpecker CI or Drone CI, or GitLab CI or pretty much anything else and not worry about polluting workspace folders, the builds use containers.

And with modern frameworks and libraries, it's pretty hard to go wrong: Express and Next are okay, Laravel is okay, Spring Boot is okay, ASP.NET is okay, Ruby on Rails is okay, Django is okay, there's a lot of established options out there. Do they have pain points? Sure, but they hardly matter. Docker solved software development for me.

Honestly, just use whatever works for you. jQuery has its place, so does Node and PHP. I think I even have some Perl running somewhere.

Re:jQuery v4.0 Beta by jddj on Wednesday February 07, 2024 @06:55AM (#39287448)
Opinion: If more product teams had one person high up who felt embarrassed by even one of the things in your third paragraph we'd have significantly better tech.
Re:jQuery v4.0 Beta by rfl890 on Wednesday February 07, 2024 @07:57AM (#39287976)
Express
Re:jQuery v4.0 Beta by Aeolun on Wednesday February 07, 2024 @09:49AM (#39289203)
PHP is great for getting started, but I think it gives you a fundamentally flawed idea of how the web works. You tend to think in files, and not worry about what Apache or Nginx are actually doing.

Then when you switch to node, or basically any other language, you wonder where your file based logic is, and everything feels annoying and painful.

Do you really need to host your own server to run a single file? Yes, you do with PHP too, but it’s hidden in Apache and php-fpm.

Re:jQuery v4.0 Beta by Scotrix on Wednesday February 07, 2024 @11:03AM (#39290160)
The funny thing, even with React and Next, it’s ultimately just files served via a Webserver and I believe it’s the least flawed version you can get without building your own implementation of a TCP server which support HTTP (good luck with that btw ;-)).

Nowadays the basics are just abstracted away and talking with developers today who might even have never seen the basic version of an on old-school Webserver or a simple HTTP request executed manually via telnet runs sometimes into really weird error and root causes analysis.

So sometimes I wish the younger developers would know a bit more from the old world while the older developers now a bit more of the new world of web technologies (apache and a cgi driven bash script are not always the best solution even if you can squeeze ultimately everything into making even that work depending on your time and sadistic level :-)).

Most of the modern solutions out there have been developed to solve very specific problems for a certain group of people (see the difference between React and Angular in that regard) and not always the solution everyone seems to use is the best for your problem, team and business.

Re:jQuery v4.0 Beta by Capricorn2481 on Wednesday February 07, 2024 @10:14AM (#39289526)
I guess as someone that likes php and is meh on Next JS and uses both for most of their job, this seems like an unfair comparison. You have node woes listed here, but nothing about different PHP versions or the headache of migrating from 7.4 to 8 (which every app is overdue for). And while composer can be good, managing php extensions is a nightmare in my eyes. Xdebug in particular is bizarre to me. I'm so used to being able to debug something in an IDE by default that I'm surprised when I switch to a certain PHP version for a project and forget the debugger won't work here until I set up the extension again.
Re:jQuery v4.0 Beta by geek_at on Wednesday February 07, 2024 @02:46AM (#39285712)
plus you don't need to restart any services or rebuild servers. Just git pull and you have the new code on the live server without even a second of downtime
Re:jQuery v4.0 Beta by flemhans on Wednesday February 07, 2024 @09:10AM (#39288760)
watch -n 1 git pull
Re:jQuery v4.0 Beta by vmfunction on Wednesday February 07, 2024 @05:25AM (#39286784)
In node there is EJS which is basically PHP templating with JS.
Re:jQuery v4.0 Beta by postepowanieadm on Wednesday February 07, 2024 @02:46AM (#39285711)
Even better - you may use service workers as your 'server-side'.
Re:jQuery v4.0 Beta by PrimeMcFly on Wednesday February 07, 2024 @12:21AM (#39284818)
> JavaScript is a must, not optional.

I build plenty of CSS only sites without any JS just fine. I avoid using it as much as I can and generally only need it for forms or galleries, occasionally some ajax stuff.

But it's seldom required.

Re:jQuery v4.0 Beta by manuelmoreale on Wednesday February 07, 2024 @08:00AM (#39288004)
Just want to say I appreciate you for doing that.
Re:jQuery v4.0 Beta by PrimeMcFly on Wednesday February 07, 2024 @08:42AM (#39288429)
Thanks :)

It just seems like good practice. I want my sites to be as fast, minimal, compatible and as usable as possible, while still looking and feeling modern.

Re:jQuery v4.0 Beta by manuelmoreale on Wednesday February 07, 2024 @02:36PM (#39293177)
I hear you. My site is 1 http request and no js so I’m definitely with you on this.
Re:jQuery v4.0 Beta by p-e-w on Tuesday February 06, 2024 @10:32PM (#39284137)
One website that almost always gets mentioned when people talk about jQuery today is "You might not need jQuery" (https://youmightnotneedjquery.com/).

That site is the best ad for jQuery I've ever seen. For almost every task it describes, the jQuery code is shorter, cleaner, and more intuitive than the vanilla "modern" JS one.

And that's after almost 20 years, and I don't know how many billions of dollars invested into advancing JavaScript.

Re:jQuery v4.0 Beta by Finbarr on Tuesday February 06, 2024 @10:48PM (#39284258)
This is incredible and such a great ad for jQuery. It's almost as if the creator(s) built that site ironically. So many examples are way clearer and easier in jQuery, like this one:

  JQUERY:
  $(el).toggle();

  IE8+:
  function toggle(el) {
    if (el.style.display == 'none') {
      el.style.display = '';
    } else {
      el.style.display = 'none';
    }
  }
Gotta love that "modern" triple attribute repetition.

From: https://youmightnotneedjquery.com/#toggle

Re:jQuery v4.0 Beta by extra88 on Wednesday February 07, 2024 @12:01AM (#39284689)
A more modern solution would be to use classList.toggle() or toggleAttribute(hidden).
Re:jQuery v4.0 Beta by 1123581321 on Tuesday February 06, 2024 @11:43PM (#39284575)
Toggle was a bit of a pitfall because the developer had to keep track of all the possible states prior to that line. It's easy to drop in as a function when needed in simple scripting (expanding faq sections, etc.)
Re:jQuery v4.0 Beta by mschuster91 on Wednesday February 07, 2024 @02:55AM (#39285766)
> Gotta love that "modern" triple attribute repetition.

You can golf it down a bit:

    el.style.display=el.style.display == 'none' ? '' : 'none';
Re:jQuery v4.0 Beta by anakaine on Wednesday February 07, 2024 @03:54AM (#39286140)
Even though I can appreciate the elegance of your solution, I'd prefer the former for clarity.
Re:jQuery v4.0 Beta by OJFord on Wednesday February 07, 2024 @09:17AM (#39288821)
Surely

    el.style.display = el.style.display ? 'none' : ''
(after toggling we've already obliterated any possible third value for it anyway, doesn't seem significant)
Re:jQuery v4.0 Beta by Finbarr on Wednesday February 07, 2024 @11:04AM (#39290176)
Of course. Because that's infinitely better than:

  $(el).toggle();
Re:jQuery v4.0 Beta by frereubu on Wednesday February 07, 2024 @03:37AM (#39286034)
IE8 is a bit of a straw man. We've dropped IE entirely when testing unless there's significant (1%+) usage for particular clients, but even the NHS in the UK has dropped IE11.

Edit: https://caniuse.com/?search=classlist.toggle and click Usage Relative.

Re:jQuery v4.0 Beta by fwip on Wednesday February 07, 2024 @11:53AM (#39290877)
Plus, the jQuery example also accepts any selector for `el`, including ones that select multiple elements.

The `toggle(el)` function only accepts a single element that you've already selected (e.g: via `document.getElementById("foo")`). You'd need to at least add a call to `querySelectorAll(...).foreach(toggle)`, if you wanted to preserve that piece functionality (which you admittedly don't always want).

Re:jQuery v4.0 Beta by piaste on Friday February 09, 2024 @04:16AM (#39313000)
> It's almost as if the creator(s) built that site ironically.

No, the site's advice is simply more narrow and fine-grained than a blunt 'never use jquery'. From the front page:

> jQuery and its cousins are great, and by all means use them if it makes it easier to develop your application.

> If you're developing a library on the other hand, please take a moment to consider if you actually need jQuery as a dependency. Maybe you can include a few lines of utility code, and forgo the requirement.

This seems eminently reasonable to me. For a website, adding a jquery dependency costs little and you get much nicer, more maintainable code.

But for a library, every transitive dependency introduces the possibility of future version conflicts for applications that depend on it. And at the same time, library code shouldn't need to change and grow nearly as much as application code.

So library authors should strongly consider forsaking mere convenience for the sake of reducing dependency baggage. This isn't even JS-specific advice, it applies to most ecosystems.

Re:jQuery v4.0 Beta by tipiirai on Tuesday February 06, 2024 @10:44PM (#39284223)
It's the jQuery API design. I often find myself creating functions like this one:

export function $(query, root=document) { ... }

jQuery acted as a role model for standard web committees. The argument for querySelector / querySelectorAll calls is literally mimicked from John Resig's groundbreaking API design.

Re:jQuery v4.0 Beta by cxr on Tuesday February 06, 2024 @10:49PM (#39284273)
> The argument for querySelector / querySelectorAll calls is literally mimicked from John Resig's grounbreaking API design

Absolutely not.

Re:jQuery v4.0 Beta by tipiirai on Tuesday February 06, 2024 @11:13PM (#39284415)
Absolutely yes.

jQuery selector engine was developed before the official Selector API, which ended up being almost exactly the same. Except for a few exceptions which John wasn't too sure about when they asked for feedback:

https://johnresig.com/blog/thoughts-on-queryselectorall/

Re:jQuery v4.0 Beta by cxr on Wednesday February 07, 2024 @05:49AM (#39286947)
I don't know what you think that link shows (I don't know what John thought it showed, either—it's a classic "talking to one's own head, instead of who you're trying to communicate with" situation, and David Baron's confusion on the mailing list at the time is understandable).

To reiterate:

> The argument for querySelector / querySelectorAll calls is literally mimicked from John Resig's grounbreaking API design

No, it wasn't. "The argument for querySelector / querySelectorAll calls" is literally ... CSS's selector language, which predates jQuery by about a decade. And the idea to make a library function to match against selectors was conceived of and implemented by Simon Willison years before jQuery was released, spawning lots of copycats. jQuery was literally named jQuery because writing a library to do this was the hotness at the time and one such library Resig had used was called cssQuery.

(jQuery does do a lot more than just match CSS selectors, but what that involves is not something jQuery has in common with querySelector—it's nowhere near "almost exactly the same". The result of a jQuery call has a weird, jQuery-specific shape. (It's not an element node). If Simon's getElementsBySelector did what jQuery did, Resig wouldn't have written jQuery.)

This is a matter of public record, and to state or suggest otherwise is worse than just being wrong. It misleads and confuses people.

<https://twitter.com/simonw/status/1536129600232665088>

<https://www.slideshare.net/jeresig/history-of-jquery>

Re:jQuery v4.0 Beta by jve on Wednesday February 07, 2024 @07:12AM (#39287589)
So you couldn't get away with lazy and ignorant two word answer and it forced you to write quality one :)

One would argue whether we'd have querySelector if jQuery wasn't as popular. We may have an inspiration chain here... but thanks for pointing out to prior art.

Re:jQuery v4.0 Beta by cxr on Wednesday February 07, 2024 @07:43AM (#39287855)
You're mixed up in your understanding of how burden of proof works and who has it here. Spoiler alert: it's the burden of the person making the claim—not the one dismissing it.

> lazy and ignorant

Go fuck yourself.

Re:jQuery v4.0 Beta by dang on Thursday February 08, 2024 @05:25PM (#39308630)
Please don't cross into personal attack, regardless of how provocative someone is being or you feel they are. It's not what this site is for, and destroys what it is for.

https://news.ycombinator.com/newsguidelines.html

Re:jQuery v4.0 Beta by dang on Thursday February 08, 2024 @05:24PM (#39308623)
Please don't cross into personal attack, regardless of how wrong someone is or you feel they are. It's not what this site is for, and destroys what it is for.

https://news.ycombinator.com/newsguidelines.html

Re:jQuery v4.0 Beta by Macha on Wednesday February 07, 2024 @09:43AM (#39289139)
Using CSS to select elements within the browser arguably only became popular because of jQuery, (and Prototype, Mojo, etc.). The browser inbuilt suggestion at the time was to programmatically navigate the DOM, or maybe use XPath. Proposing CSS selectors as a browser API before it became dominant in the wild via alternatives would have got a "why do we need another option?" response.
Re:jQuery v4.0 Beta by LamaOfRuin on Tuesday February 06, 2024 @11:01PM (#39284337)
>For almost every task it describes, the jQuery code is shorter, cleaner, and more intuitive than the vanilla "modern" JS one.

Just like leftpad.

Re:jQuery v4.0 Beta by ipaddr on Tuesday February 06, 2024 @11:54PM (#39284646)
Instead of needing to import leftpad you have the missing standard js lib
Re:jQuery v4.0 Beta by krapp on Wednesday February 07, 2024 @06:24AM (#39287190)
It isn't missing. Javascript was created to serve a specific purpose, which didn't include left-padding text in a terminal. Most language I'm aware of wouldn't have that in their standard lib.

If you want Javascript to act as a drop-in replacement for C++ or Java or some other general programming language (which Javascript was never intended to be) don't act as if needing to write libraries to cover that missing functionality is a problem with the language. You're using the wrong tool for the wrong job.

Re:jQuery v4.0 Beta by selcuka on Wednesday February 07, 2024 @07:16AM (#39287627)
> Most language I'm aware of wouldn't have that in their standard lib.

Python has str.ljust [1] (and str.rjust [2]):

> Return the string left justified in a string of length width. Padding is done using the specified fillchar (default is an ASCII space). The original string is returned if width is less than or equal to len(s).

[1] https://docs.python.org/3/library/stdtypes.html#str.ljust

[2] https://docs.python.org/3/library/stdtypes.html#str.rjust

Re:jQuery v4.0 Beta by Macha on Wednesday February 07, 2024 @09:07AM (#39288724)
C has it in their standard library, basically forever. See the list of specifiers to printf. C! If it fits into the C standard library, it's not bloating the Javascript standard library.
Re:jQuery v4.0 Beta by chipotle_coyote on Wednesday February 07, 2024 @09:12AM (#39288773)
Ruby and PHP both have string padding functions. So does Swift. (edit: and as Macha points out, C and any language with printf functionality, like Perl.) It’s not that uncommon.

(I was going to joke that TRS-80 BASIC had it circa 1979, but it turns out that it would be a two-step operation: Python’s str.ljust(40) would become LEFT$(STRING$(40, " "),40) .)

Re:jQuery v4.0 Beta by jampekka on Wednesday February 07, 2024 @04:44AM (#39286490)
Much of the billions are used to make JavaScript worse. E.g. ESM is a byzantine mess compared to CJS, and the ceremony and bondage of TypeScript is dramatically increasing busywork.
Re:jQuery v4.0 Beta by admaiora on Wednesday February 07, 2024 @04:46AM (#39286504)
Yesterday I was checking HN from 10years±2weeks ago and guess what the top posts were... "Why you need jQuery" and "You might not need jQuery". I'm too young to know about those days but I guess not much has changed in relation to people's attitude towards jQuery.
Re:jQuery v4.0 Beta by krapp on Wednesday February 07, 2024 @06:26AM (#39287208)
What's changed is the billion dollar tech industry invested in convincing people that JQuery is a dead and obsolete technology.

For some reason, JQuery is the exception to the general rule of seeing a mature, battle-tested library as a sign of quality.

Re:jQuery v4.0 Beta by Macha on Wednesday February 07, 2024 @09:05AM (#39288682)
The problem jQuery was solving was to provide a usable abstraction over an inconsistent platform for core functionality like event handling and DOM manipulation.

The point of the last decade and a half of standards work was to eliminate that problem, and it has at least moved it from "core web functionality" to more complicated areas like bluetooth, 3d rendering and audio, which jQuery's goals do not include handling.

Is it urgent to remove jQuery from projects? Not really. And it's good the jQuery team maintain the project for that reason. Certainly some projects have gotten performance gains out of removing it, but part of the work they've done in 3.x and now 4.x is arguably jQuery removing stuff internally and replacing them with the now reliable browser APIs.

But on the other hand, is there a great argument for including jQuery in new projects? This is also a "not really".

Re:jQuery v4.0 Beta by gunapologist99 on Wednesday February 07, 2024 @11:55AM (#39290925)
That was part of the problem that jQuery was solving.

Another part was the abysmal API that Javascript (and mostly still today) offers to work with the DOM.

Re:jQuery v4.0 Beta by collyw on Wednesday February 07, 2024 @09:33AM (#39289013)
It was initially sold as a way to fix browser incompatibilities, but I still use it because there are really nice plugins like select2. I really don't see the point in SPA apps for the most part. Fair enough if you have a heavily interactive frontend, but I can build an app in Django with a bit of JQuery and end up with around half the code compared to adding in React.
Re:jQuery v4.0 Beta by marcosdumay on Wednesday February 07, 2024 @09:27AM (#39288943)
That site message is "don't import all of jquery just to use the $ global and one or two specific functions".

It's a very fine message and the site contents spread it quite well. But if you actually want to use jquery instead of just some function you got from a reference, by all means, use it, it's a very nice library.

Re:jQuery v4.0 Beta by midasuni on Wednesday February 07, 2024 @02:14AM (#39285510)
Yesterday I wrote a custom page which dumped out a table for some investigation. I threw jquery and a tablesorter plug-in. Without JS you get the table, but with you can easily sort and filter. Took about 2 minutes to add the optional filter. The backend is bash of course.
Re:jQuery v4.0 Beta by sireat on Wednesday February 07, 2024 @03:02AM (#39285816)
For tables my favorite jQuery plug-in is: https://datatables.net/

Have a page with some tables? A few lines of jQuery and you have search sorting etc. It can be customized but defaults are fine.

This is how abstractions and progressive enhancement should be done.

Re:jQuery v4.0 Beta by midasuni on Wednesday February 07, 2024 @03:25AM (#39285959)
I’m not even sure what I used, it’s the same 5 lines I’ve used for years. Boom bang and on to the next problem.

For every unicorn saas webapp $300k a year developers are writing there’s a thousand small pages. If you’re building a house you aren’t going to use a Swiss Army knife, but if you’re camping out for a couple of days you aren’t going to take a van full of power tools.

Re:jQuery v4.0 Beta by anakaine on Wednesday February 07, 2024 @03:53AM (#39286131)
A couple.of well selected power tools are certainly helpful, however. A battery blower to start the fire, a small electric chainsaw for any wood cutting depending on the area and what you take in, and a portable fan if you're in a hot climate. Sometimes a couple of selected power tools are very helpful.
Re:jQuery v4.0 Beta by ryanisnan on Thursday February 08, 2024 @01:55AM (#39299080)
Weird analogy. I’ve camped my whole life, never once brought a power tool.
Re:jQuery v4.0 Beta by GrumpyNl on Wednesday February 07, 2024 @04:11AM (#39286264)
Big plus is, it also gives yo the option to export the tables to pdf and other file formats.
Re:jQuery v4.0 Beta by mobilemidget on Wednesday February 07, 2024 @12:20PM (#39291250)
I personally prefer https://sortablejs.github.io/Sortable/ over datatables.net

Though both do what I typically need them to do, customising datatables.net takes me a bit more time though

Re:jQuery v4.0 Beta by erhaetherth on Tuesday February 06, 2024 @11:02PM (#39284349)
If you don't want to use a big framework, then you needn't use any library at all. Nearly everything in jQuery is 1 line of modern JS, no?
Re:jQuery v4.0 Beta by pier25 on Tuesday February 06, 2024 @11:24PM (#39284479)
One line of jQuery can replace many lines of vanilla js.
Re:jQuery v4.0 Beta by colordrops on Tuesday February 06, 2024 @11:23PM (#39284474)
Yes, there isn't much reason to use jQuery these days other than keeping with the idioms of a legacy system.
Re:jQuery v4.0 Beta by troupo on Wednesday February 07, 2024 @02:10AM (#39285487)
Nearly everything in jQuery is more concise, consistent and composable compared to modern JS APIs. As this site clearly shows: https://youmightnotneedjquery.com/
Re:jQuery v4.0 Beta by masklinn on Wednesday February 07, 2024 @04:27AM (#39286388)
> Nearly everything in jQuery is 1 line of modern JS, no?

Since JavaScript never actually requires line breaks, yes.

Otherwise, absolutely not. Modern web APIs remain highly statements-based, with little affordance for pipelining / cascading.

Re:jQuery v4.0 Beta by krick on Tuesday February 06, 2024 @11:04PM (#39284363)
I won't dare to predict where industry "is going to move", since I'm not really a frontend developer, so what do I know anyway (and especially since it seems to switch directions every couple of years, and mostly being pulled in all directions simultaneously). But personally I still prefer to use stand-alone JS-scripts and libs included directly into the page, if I can. Mostly because I hate having to deal with complicated (and, importantly, rather slow) build process just for the sake of a couple of web-pages, when the real stuff is some totally invisible backend processing or maybe some sort of HTTP API to be used by other services.

Also, honestly, I really just don't know what's the "correct" way to do things in 2024 on frontend, and I don't know where to even look for a guide, if I don't really want to spend next 6 months entirely in the pursuit of attaining "real" frontend-dev proficiency, but ultimately just to make working stuff, even if it doesn't quite follow the v2024 web-etiquette.

Re:jQuery v4.0 Beta by palmfacehn on Wednesday February 07, 2024 @01:24AM (#39285180)
"Etiquette" implies there is some civilizing force. A system that allows us to coexist in peaceful, accessible sanity.

Someone said of a profitable app/site I created with vanilla JS, "But this is looks like it is just a Bootstrap site"

At this point, functionality be damned, customers expect a loading spinner. The norm is something that doesn't load on the first request. Sites don't paint the screen until 10 seconds later, because they are avoiding repaints. Maybe 10-20mb of JS is included in the typical app in this niche. Many totally fail on Firefox. Ambiguous user facing errors on a black screen, "An application client side error occurred" are par for the course.

Re:jQuery v4.0 Beta by rdedev on Tuesday February 06, 2024 @10:23PM (#39284072)
I'm not a web developer but sometimes I have to make a page with some JS functionality. jQuery saves me a lot of time in such cases
Re:jQuery v4.0 Beta by webworker on Wednesday February 07, 2024 @12:11AM (#39284750)
I keep saying this. At some point, some very smart people are going to figure out how expensive React is to build and maintain, and it’s going to change the conversation.
Re:jQuery v4.0 Beta by esaym on Tuesday February 06, 2024 @10:45PM (#39284228)
>But jQuery doing dynamic binding to dynamically generated forms

Do you have an example of that?

Re:jQuery v4.0 Beta by DonHopkins on Wednesday February 07, 2024 @01:46AM (#39285303)
Re:jQuery v4.0 Beta by ourmandave on Wednesday February 07, 2024 @07:05AM (#39287525)
More that one line, doesn't count! =D
Re:jQuery v4.0 Beta by DonHopkins on Wednesday February 07, 2024 @05:20PM (#39295091)
It's one line when minimized! ;)
Re:jQuery v4.0 Beta by bufferoverflow on Tuesday February 06, 2024 @10:11PM (#39283995)
jQuery is not awesome.

It was awesome 15 years ago. Now it's completely outdated. It's very hard to reason about DOM that can be manually changed by any random piece of code. That's why declarative solutions like React/Vue/Svelte are so much better.

Re:jQuery v4.0 Beta by rjbwork on Tuesday February 06, 2024 @10:19PM (#39284046)
>It's very hard to reason about DOM

I don't mean to be overly snarky here, but as someone who's just totally out of their depth in modern web UI - is that why people like these frameworks? Because they're very easy to reason about? I've generally found them to be mountains and mountains of boilerplate and spaghetti, but I really do not have a wide base of experience to pull from on this topic.

Re:jQuery v4.0 Beta by Capricorn2481 on Tuesday February 06, 2024 @10:29PM (#39284114)
I started with Jquery, I learned React. I prefer React.

React complexity is often conflated with things like Next JS or other SPA solutions. React was originally meant to be a library for building small components that you drop into an otherwise static websites. But people usually don't talk about React unless they're talking about whole sites being in React. For that reason, I think its complexity is exaggerated.

More importantly, what the commenter is referring to is the fact that you are encouraged to write Jquery code that can break if you decide to move a div or change a class name. The workflow of CSS selectors is fine for small apps, but can lead to hard to track bugs down the road. It can be avoided if you make a lot of unique IDs. But otherwise you're screwed. There's no scoping. You technically have to read every piece of Jquery code before changing any other code, html, or css, because you could break half the site depending on what people were depending on. There's no IDE support telling you what is selecting what. Events are not colocated on the things they attach to, they could be anywhere.

I can update a React component and be sure that the only places it affects are the places its rendered. And I can get type checking on every input going into a component. That's just way better to me.

I still use JQuery at work, but I usually dread it. And people say JQuery is "smaller" but I would still prefer something like Svelte to Jquery if that's a concern.

I can take or leave Vue, I don't really notice a huge difference between it and other component frameworks.

Re:jQuery v4.0 Beta by treflop on Tuesday February 06, 2024 @10:48PM (#39284259)
I’m a big fan of React and jQuery but it sounds like you’re not using jQuery right.

All my jQuery components were self contained and you just initialized them with $(‘[data-date-picker]’).datePicker(). It is pretty obvious to anyone looking at the code that if you remove “data-date-picker”, it stopped being a date picker.

Re:jQuery v4.0 Beta by erhaetherth on Tuesday February 06, 2024 @11:08PM (#39284390)
Then you have dumb stuff like if you check a box and want some additional form fields, you have to inject a div or input into the DOM manually, and then make sure you initialize your datepicker, but maybe there will be a flash of unpickerified input if you don't do it right.
Re:jQuery v4.0 Beta by spiderice on Wednesday February 07, 2024 @12:54AM (#39284991)
I haven’t used jquery in 10 years or so, but I’m pretty sure this isn’t what you would do. You would just hide or unhide the inputs with jquery.
Re:jQuery v4.0 Beta by Capricorn2481 on Tuesday February 06, 2024 @10:57PM (#39284315)
That is true, but this is built-in to React and it's optional for JQuery. I am working on legacy projects a lot and nobody ever writes JQuery like this outside of famous libraries.
Re:jQuery v4.0 Beta by rolisz on Wednesday February 07, 2024 @01:51AM (#39285352)
React was developed by Facebook. I don't think they did it for small components on otherwise static sites.
Re:jQuery v4.0 Beta by Capricorn2481 on Wednesday February 07, 2024 @02:59AM (#39285791)
Facebook was a fairly static site back then, but small is a relative term here. I don't mean to say it was only meant to do that. Just that the origins of React are a far cry from the complexity of SPA frameworks like Next JS. And it can still be used as quite a simple drop in component system. Nothing is stopping you from doing that. Which is why people often say React is not a framework but a library, because it's true.

https://legacy.reactjs.org/blog/2013/06/05/why-react.html

Re:jQuery v4.0 Beta by Zardoz84 on Wednesday February 07, 2024 @11:58AM (#39290972)
what I usually did, was using data-xxx attributes (and document these attributes and how works) to inject special functionality to html elements. I did this with jQuery, and now I do with vainilla JavaScript.
Re:jQuery v4.0 Beta by christophilus on Tuesday February 06, 2024 @10:28PM (#39284109)
That's one of the reasons I like them, yes. I've done a lot of manual DOM manipulation, and a lot of jQuery. When you're building anything complex, it starts to become quite difficult to figure out why a particular piece of the DOM is behaving the way it is. It could be an overly aggressive selector that accidentally targeted it, or any number of things.

Prior to React (and similar libraries), DOM manipulation was generally done in a mutating, effectful way. With React (and similar), if a thing is behaving strangely, I just need to go to the component that rendered said thing, and I can almost always find the problem.

Re:jQuery v4.0 Beta by jmondi on Tuesday February 06, 2024 @10:46PM (#39284235)
For your blog, jquery is totally fine and reasonable. Jquery for a web application? That is going to be way more of a headache. It all depends on what you’re trying to accomplish.
Re:jQuery v4.0 Beta by kccqzy on Tuesday February 06, 2024 @10:45PM (#39284231)
Yes React is easy to reason about. In fact old versions of React were even easier to reason about than modern versions using hooks (`useState`). I used to use React and just React: no random npm packages, no Babel or any transpilation, no JSX, and it was pure joy compared to jQuery in a complex multi-step form. The jQuery code was in fact spaghetti.
Re:jQuery v4.0 Beta by marcosdumay on Wednesday February 07, 2024 @09:33AM (#39289016)
I guess the "easy to reason about" thing people keep saying is meant to tell you that the modern frameworks allow modularization.

Personally, I do find their style of modularization abhorrent. As you said, it's full of boilerplate, it's also full of dependencies, and the worst sin in a software architecture: they don't enable you to specify a simple interface between modules. But they do solve the lack of structure you get when all the code talks to each other freely through the DOM.

Re:jQuery v4.0 Beta by docmars on Wednesday February 07, 2024 @01:13PM (#39292029)
Creating a brand new Vue app using Vite as your build system (official) takes less than 2 minutes and you can immediately start using Vue by following its documentation and creating a well-organized web application with its friendly patterns and solutions to the most common pro-UX problems you could encounter in a web app.

Give it a shot, it's stupid-easy, and that's not downplaying anything either.

Re:jQuery v4.0 Beta by rjbwork on Thursday February 08, 2024 @10:35AM (#39303116)
This is pretty funny because the front end team at my company decided last year to migrate from Vue to React because Vue is too complicated and it's hard to find people who know it vs React. Impossible for me to get a read on this stuff. Such a clusterfuck of an ecosystem.
Re:jQuery v4.0 Beta by docmars on Saturday February 10, 2024 @12:09AM (#39323764)
Yea there's certainly a lot of mixed opinions and learning curves involved to be sure. On the one hand, I love how many options there are to build web applications, but on the other, it really does feel fragmented and hiring front-end engineers is a huge gamble with all the different preferences involved because there is no true concept of "standards" everyone follows.

Thankfully it's pretty easy to align a team with a little time and learning what everyone wants.

Re:jQuery v4.0 Beta by scotty79 on Thursday February 08, 2024 @03:39PM (#39307369)
You can make spaghetti with everything. But without framework spaghetti is even worse. People who make a mess out react do it because they try to use it as if it is jquery.
Re:jQuery v4.0 Beta by williamcotton on Tuesday February 06, 2024 @10:49PM (#39284272)
That is not why React became popular. We have to go back to the end of the server-side ORM era. ERB templates creating an LI element in a certain manner and jQuery creating the same element. So have fun keeping those DOM elements in sync! This and the ever expanding DOM APIs led to single page applications where all of the markup was generated by the client. Cue, oh fuck this is slow and oh fuck, page loads and SEO suffers, so then we see the emergence of virtual DOMs along with server-side Javascript, and we are now generating the same DOM elements with the same code on the front and back. Then everyone realized we are making these complex applications with an untyped language with lots of warts… Flow and Typescript emerge.

Guess what? Spooky action at a distance continues with reducers, custom hooks, custom injected contexts, etc, etc.

Re:jQuery v4.0 Beta by genocidicbunny on Tuesday February 06, 2024 @10:23PM (#39284071)
> It's very hard to reason about DOM that can be manually changed by any random piece of code.

I think the parents point is that many websites don't need to change all that much DOM manually, automatically, or in any fashion. And I would agree with them, that for when the only 'dynamic' part of your site is one or two simple forms, and maybe a little carousel of images, jQuery may be perfectly awesome.

Re:jQuery v4.0 Beta by hsbauauvhabzb on Wednesday February 07, 2024 @12:14AM (#39284773)
I learnt jQuery and I would say ‘I could code in jquery, but not pure JavaScript’ - that’s since changed but I do still find foreach jQuery iteration by classname fairly elegant, in addition to $.get and $.post.

I’m not saying that it’s good or bad, but maintenance may mean developers who don’t know or care for modern web don’t have to learn something new.

Re:jQuery v4.0 Beta by drschwabe on Tuesday February 06, 2024 @10:24PM (#39284077)
It's good for quick things and prototyping cause you can always swap out those calls with native later. It's API is generally easier to remember/less typing that most native equivalents. You can also use its API serverside via Cheerio to do parsing & manipulation of html without a dom.

edit: also its way more lightweight than React/Vue/Svelte i don't necessarily disagree you shouldn't reach for jQuery if you have a dynamic page (something like uhtml+preact signals would be good if you have fair bit of rendering logic going on) but I would say you should totally try seeing how far you can get with jQuery instead of Svelte/React/Vue on simple pages.

Re:jQuery v4.0 Beta by zztop44 on Wednesday February 07, 2024 @12:22AM (#39284822)
Is it really way more lightweight than Svelte? Svelte has more tooling (of course) but it ships no runtime and only sends the user the JS they actually need to interact with your page.
Re:jQuery v4.0 Beta by drschwabe on Wednesday February 07, 2024 @01:29AM (#39285210)
Well, if you're talking SvelteKit then it requires a build step so yes, jQuery is way more lightweight.

jQuery is also pure JS whereas Svelte is Typescript so it may be more difficult to debug/hack if your primarily JS coder.

Re:jQuery v4.0 Beta by labster on Tuesday February 06, 2024 @10:26PM (#39284089)
Different use cases. A lot of the web only has only one or two interactive elements in a scope. The DOM being changed by any random piece of code is not a problem when all of the JavaScript fits on two screens. In fact, it’s a benefit here.
Re:jQuery v4.0 Beta by Klonoar on Wednesday February 07, 2024 @02:22AM (#39285569)
No, if you actually make modules with jQuery where it’s creating it’s own DOM tree, it’s no different from what React & Co are doing.

Reasoning about the DOM structure has almost never been an issue in my almost 20 years of professionally doing this junk. The complexity has always been elsewhere.

Re:jQuery v4.0 Beta by alternatex on Wednesday February 07, 2024 @11:54AM (#39290901)
And you're arguing the complexity that has to be somewhere should go in your custom built jQuery modules instead of components built with a well-known framework?

I spent years maintaining front-end code built by devs who believe their way of doing things was better than what's popular in the industry and I disagree about jQuery entirely.

jQuery is a low level tool and always ends up biting people as the project grows.

Re:jQuery v4.0 Beta by Klonoar on Wednesday February 07, 2024 @05:35PM (#39295256)
> And you're arguing the complexity that has to be somewhere should go in your custom built jQuery modules instead of components built with a well-known framework?

jQuery + the DOM are well known frameworks. ;P

Re:jQuery v4.0 Beta by cxr on Tuesday February 06, 2024 @10:45PM (#39284230)
> People have been in love with the overly complex and fancy javascript frameworks for the last 15 years or so.

jQuery is an overly complex and fancy JavaScript framework.

Re:jQuery v4.0 Beta by worthless-trash on Tuesday February 06, 2024 @11:49PM (#39284618)
I think your definitive comment above 'absolutely not' has tainted how people see your authoritatively spoken statements.
Re:jQuery v4.0 Beta by cxr on Wednesday February 07, 2024 @07:57AM (#39287973)
Okay?
Re:jQuery v4.0 Beta by falsandtru on Wednesday February 07, 2024 @01:18AM (#39285151)
jQuery remains the best JSONP library. It can get data even when other libraries are blocked.
Re:jQuery v4.0 Beta by rolisz on Wednesday February 07, 2024 @01:49AM (#39285331)
If I understand this announcement correctly, they removed support for JSONP
Re:jQuery v4.0 Beta by falsandtru on Wednesday February 07, 2024 @02:02AM (#39285430)
Just removed "Automatic" JSONP "promotion". JSONP is still available.
Re:jQuery v4.0 Beta by patrickaljord on Wednesday February 07, 2024 @01:35AM (#39285242)
jQuery is amazing, still remember the joy of using it 20 years ago. That being said, React, Vue and similar are just better IMO to build and maintain complex apps. Don't get me wrong, jQuery was the best thing at its time and I will always be grateful to its contributors, but today there are better alternatives. I think htmx is nice but not seeing it taking over other frameworks.
Re:jQuery v4.0 Beta by linkjuice4all on Wednesday February 07, 2024 @01:51AM (#39285353)
Definitely agree that the modern frameworks are better for complex stuff. Ideally there’s not really a middle ground - you’re either doing complex interactive “app-like” stuff with a framework or adding modest dynamic features to otherwise static content (e.g. static export of WordPress with some jQuery for your forms).
Re:jQuery v4.0 Beta by throwaway2990 on Wednesday February 07, 2024 @03:30AM (#39285985)
lol react. Never seen a good react project. They all end up a mess.
Re:jQuery v4.0 Beta by yashg on Wednesday February 07, 2024 @02:54AM (#39285755)
Yup, jQuery is indeed awesome!
Re:jQuery v4.0 Beta by holoduke on Wednesday February 07, 2024 @02:55AM (#39285768)
You still need some kind of application framework. Jquery is just a low level utility. But higher level you need to maintain architecture. Specially in spa's
Re:jQuery v4.0 Beta by hnfong on Wednesday February 07, 2024 @03:00AM (#39285800)
You don't "need" an application framework.

People have been building websites (even SPAs) before the 2010s and they didn't "need" these frameworks.

Given what we know today, I'll grant you that in some cases people would want to use a framework, but it's hardly a necessity unless the context provides more specific requirements.

Re:jQuery v4.0 Beta by agos on Wednesday February 07, 2024 @05:07AM (#39286657)
you don't "need" a framework for backend development, too, but most people find it highly convenient
Re:jQuery v4.0 Beta by holoduke on Wednesday February 07, 2024 @06:26AM (#39287207)
Its can be convenient to have some kind of reusable conponents. Like listviews wtih certain functionality. Same for routing. Caching etc.
Re:jQuery v4.0 Beta by claytongulick on Wednesday February 07, 2024 @10:26AM (#39289654)
Native web components / custom elements work great for this.
Re:jQuery v4.0 Beta by holoduke on Wednesday February 07, 2024 @02:26PM (#39293019)
So you end up with an component framework.
Re:jQuery v4.0 Beta by bdhcuidbebe on Wednesday February 07, 2024 @07:58AM (#39287980)
You dont ”need” anything. But most people prefer some organization, familiarity and reusability, and not having to reinvent the wheel in every project they start.
Re:jQuery v4.0 Beta by khasan222 on Wednesday February 07, 2024 @06:58AM (#39287464)
I’ve been writing JavaScript for 15 years professionally, and I must say this comment seems to be made by someone not as familiar with the context here. Moving away from React and frameworks like it would require a radical rethinking of what we expect to do with web apps. Building something like google maps, google docs, figma, are definitely doable with some of these tools, but it is almost impossible to maintain. This comment truly ignore the context of why frameworks like react took off. Jquery is great if you need a slideshow on a page, and maybe just some tracking, and even then, I’ve recently opted to just use vanilla js, with things like webpack build targeting whatever versions I would need. JavaScript programming is complex because making great ux can be a non trivial task.

Please excuse any typos, written on the phone

Re:jQuery v4.0 Beta by heartbreak on Wednesday February 07, 2024 @07:54AM (#39287942)
How many React apps actually have an interface approaching the complexity of Figma or even Facebook?

No one is arguing that complex web applications don’t benefit from React and friends. It’s completely overkill for most of the web.

Re:jQuery v4.0 Beta by anthonypasq on Wednesday February 07, 2024 @10:20AM (#39289589)
why does everyone have this impression that people are using react to render a website that is 5 divs and some images, like where is this perception coming from? do you have any examples at all?

any website that has any sort of meaningful functionality and communication with a server is mostly likely using some sort of framework.

Re:jQuery v4.0 Beta by docmars on Wednesday February 07, 2024 @01:07PM (#39291950)
Agreed. There is a _lot_ of naivety around how these frameworks are perceived, from people who have never used them, or who come from different programming backgrounds (i.e. not frontend). It's amusing.
Re:jQuery v4.0 Beta by hombre_fatal on Wednesday February 07, 2024 @07:22PM (#39296163)
Yeah, there's this whole meme on HN where React competes with hand-writing the HTML of your three-page brochure website, a website virtually nobody is building.
Re:jQuery v4.0 Beta by lizardking on Wednesday February 07, 2024 @07:56PM (#39296480)
A lot of marketing agency development is this sort of brochureware, and to your point they usually aren't using react.
Re:jQuery v4.0 Beta by silent_cal on Thursday February 08, 2024 @10:39AM (#39303171)
These crazy libraries might make sense to you because you've been a JS dev for 15 years. JS is supposed to be a basic building block of the web. React places a learning curve in front of the everyday developer that is effectively impossible. It's fine if it's helpful in edge cases, but it shouldn't be the norm. Basic technology should be accessible.
Re:jQuery v4.0 Beta by lucsky on Wednesday February 07, 2024 @09:53AM (#39289257)
No, the "industry" is not going to move away from React (or Vue or Solid or Svelte), but idiots on HackerNews (and Reddit and Twitter and Mastodon, etc) might finally stop conflating web SITES and web APPS. One can dream.
Re:jQuery v4.0 Beta by cphoover on Wednesday February 07, 2024 @11:09AM (#39290239)
Agreed...Another gripe... the amount of people on HN complaining that a web-app doesn't 'work without JS, when the number of user's who disable JS inside their browser is well under 1%. HN users don't even consider they are not in anyway typical web users.
Re:jQuery v4.0 Beta by spillguard on Wednesday February 07, 2024 @10:06AM (#39289433)
From the guidelines:

"Be kind. Don't be snarky. Converse curiously; don't cross-examine. Edit out swipes."

Re:jQuery v4.0 Beta by lucsky on Wednesday February 07, 2024 @10:27AM (#39289666)
You're right, this was 100% sent out of frustration and I probably shouldn't have. I still think that the level of nonsense in this comment section is of galactic proportion though.
Re:jQuery v4.0 Beta by dagss on Wednesday February 07, 2024 @11:41AM (#39290731)
Unpoly too (very similar to htmx but the small difference makes it a lot more convenient I feel, I wonder why Unpoly isn't getting as much traction as htmx)
Re:jQuery v4.0 Beta by docmars on Wednesday February 07, 2024 @01:04PM (#39291905)
Organizing a large jQuery project is absolute hell though. I'll take modern frameworks like Vue any day. The ease of shipping a full-fledged app that feels easy to create and maintain began with Vue (and Svelte).

React tries to achieve the same result, but if you don't use it perfectly right, you're in for hours and hours of headaches and non-solutions.

Re:jQuery v4.0 Beta by pjmlp on Thursday February 08, 2024 @05:10AM (#39300263)
Fully agree, jQuery + Bootstrap + standard Web + SSR, and we're gold.
Re:jQuery v4.0 Beta by silent_cal on Thursday February 08, 2024 @10:35AM (#39303115)
I read that the JS fetch API makes jQuery obsolete, is that not true?