Live data from Hacker News

jQuery 3.6.0

blog.jquery.com

121–130 of 292 posts

Re: jQuery 3.6.0

#121
post #5

I know jquery is still in use a lot all over the web, but are people still starting new projects with it?

Absolutely. Starting most new projects with something like React/Vue is complete overkill and jquery makes adding small incremental JS functionality to your app a breeze.

Re: jQuery 3.6.0

#122
I think jQuery is amazing, but one thing that I've found over the years is that the real killer for it was CSS animations becoming simpler to use and more widespread in terms of support.

The final thing I used to reach for jQuery for was animation support, but that need is by and large gone now. AJAX/JSONP is good there, but to be honest it's not something that needs a wrapper these days.

Glad to see the library is still updated, though - for sites that might not have a budget to upgrade, knowing it's still got support must be nice.

Re: jQuery 3.6.0

#123
post #98

Earlier quoted context omitted.

Your example does not work. querySelectorAll returns array and you can't write `array.classList.add("...")`, because array does not have that property. You need to iterate over that array. And that's exactly why jQuery is so much more convenient over native API: you can just treat collections of elements like an element and jQuery will iterate for you if necessary. Another jQuery advantage is pseudo-selectors which d…

querySelectorAll returns a NodeList, which is even more limited than an array (e.g. no map or filter).

but [...querySelectorAll()] does return an array and is just as concise

Re: jQuery 3.6.0

#124
post #60

Earlier quoted context omitted.

You don't have to use all of it though, right? You can choose to only only use the applicable parts: eg: ``` $('.container-element') .addClass('active'); // vs document.querySelectorAll('.my-class-selector') .classList.add('active') ``` I use the native APIs all the time, they are not that complicated or overly verbose. Easily memorized with practice IMHO. Also they are all extremely well documented on MDN.

Technically that breaks, you want: document.querySelectorAll('.my-class-selector').forEach(el => el.classList.add('active')) Personally I use the native APIs because they aren't that hard to use (most of them, anyways) and I tend to be OCD about bundle sizes, but to each their own, I suppose.

Yeah, oh so many years ago I realized that I use just a small subset of jQuery, and just rewrote those bits, to avoid having to inject whole of jQuery into all pages that I browse (I had some global https?://* userscripts, so I was basically injecting jQuery into every single page and frame).

https://megous.com/dl/tmp/basic.js

1.3kB compressed. Much better. :) And I avoided having to rewrite my extensions with platform APIs. That was before FF killed all the joy in writing userscripts for me, because I was no longer able to install and update them just by copying them to mozilla folder and had to invoke a lot of clicking ceremony to just get my 20 scripts or so from git into firefox past the webextension limitations on storage/access to mozilla folder.

Re: jQuery 3.6.0

#126
post #6

Do people still use jQuery? I thought the biggest advantage of this library back in the day was css selector access of DOM nodes (back when we only had getElementById, getElementsByClassName, and getElementsByTagName). This has been rolled into the Javascript document api via document.querySelector, and document.querySelectorAll. Also there are browser compatibility issues that jQuery solved but a lot of these are so…

> Do people still use jQuery?

All the time.

> This has been rolled into the Javascript document api via document.querySelector, and document.querySelectorAll.

The official replacements for the stuff jQuery does tend to be verbose and non-orthogonal, as compared to the much more unified and consistent API of jQuery.

Re: jQuery 3.6.0

#127
post #110

Earlier quoted context omitted.

That's more like redux and company...

Yeah, but redux etc gained traction with React, and together they make SPAs good.

SPAs were perfectly good before with ExtJS and similar, and more easily extensible too.

Re: jQuery 3.6.0

#128
jQuery solved (and solves) a lot of browser inconsistencies (fewer now than before) and I guess a lot of older codebases still rely on it, so I am glad to see it is still moving forward. However, jQuery has a built in problem in modern web development, as the DOM-functions that now makes it obsolete, as in it does not solve the more complex problem of state management and scoping of components. For some sprinkling on top of server side rendered web pages I guess it still has some value if you need to cater for older web browsers, but for those who build applications that handles state and components for the current setup of browsers it is not needed in your toolbox any more when bootstrapping new projects. However, it helped us getting to a point where we could rely on solid libraries and focus on building better user experiences. I am glad it still gets updated but will probably not write "jQuery-code" anymore in my professional life.

Re: jQuery 3.6.0

#129
post #22
post #6

Do people still use jQuery? I thought the biggest advantage of this library back in the day was css selector access of DOM nodes (back when we only had getElementById, getElementsByClassName, and getElementsByTagName). This has been rolled into the Javascript document api via document.querySelector, and document.querySelectorAll. Also there are browser compatibility issues that jQuery solved but a lot of these are so…

I think a lot! For example, the new https://www.whitehouse.gov uses jQuery. When you just want to add a small bit of interaction to a mostly-static site, jQuery can help. There's a current trend to complicate things with a JAM stack that really don't need to be complicated. I've seen people propose something like [NodeJS/Ruby/PHP backend] -> GraphQL API -> React Frontend -> static html Where really they could have ju…

whitehouse.gov uses jquery because its wordpress

Re: jQuery 3.6.0

#130

Earlier quoted context omitted.

> When you just want to add a small bit of interaction to a mostly-static site Then I'd reach for Alpine. Very lightweight, and I can use the fetch API instead of $.ajax.

Perhaps even htmx? https://htmx.org/

This looks very cool, thanks.
Post reply on HN