Live data from Hacker News

jQuery 3.6.0

blog.jquery.com

91–100 of 292 posts

Re: jQuery 3.6.0

#91
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…

Well, Wordpress and Drupal still uses jQuery, they auto load it by default and there is no reason not use at this point, unless you specifically building React or some other custom thing on top of either of them.

Re: jQuery 3.6.0

#92
post #22

Earlier quoted context omitted.

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…

There's no need to complicate static sites with jQuery. All it does can be achieved with vanilla.

Vanilla has always been able to do what jQuery can, otherwise jQuery wouldn't exist. It all depends on what your threshold for abstraction and verbosity is. That is going to depend on what you are doing and who you are.

Re: jQuery 3.6.0

#93
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 help teach an introductory programming class to high school students. We still use jQuery to teach basic programming concepts, because it helps students add basic interactivity to a web page without a) the overhead of learning a full framework like React, or b) exposing them to the insanity of web APIs. Check out the curriculum if you're interested: https://github.com/itscodenation/curriculum-20-21

If you just want to add simple interactivity to a web page, jQuery provides a really nice API to do just that. Sure it's not the ideal thing to build a whole SPA on, but it has its place.

Re: jQuery 3.6.0

#94
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…

There were other things like the "Ajax" (remember that word?) API, but that one's also been matched by a native API (fetch())

> keeping state within the DOM has fallen out of favor of more comprehensible state management inside of JS

Not everything needs a whole reactive templating library. There's absolutely still a usecase for mostly-static sites to do imperative DOM manipulation.

The usecase for jQuery itself these days is dodgier, since as you point out most of its big features are native now. It should still help with browser compatibility (not necessary for modern-ish browsers, but many sites don't want to limit themselves to modern-ish browsers), its APIs are arguably still a little nicer in some places, and it does have a significant ecosystem of plugins so there's probably some value in having that stuff integrate together. But personally I would have a hard time justifying a whole library just for slightly nicer APIs unless I was doing something significantly complicated, and at that point I would just use React.

Re: jQuery 3.6.0

#95

I'm a happy jQuery/Bootstrap user @ https://forwardemail.net . The site scores ~100% on Lighthouse and PageSpeed Insights and is ranked #1. Open-startup @ https://forwardemail.net/open-startup ! Completely open-source too @ https://github.com/forwardemail

Do you use automatic translation? At least the German version feels a bit odd.

Re: jQuery 3.6.0

#96
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?

Oh yes. Very much so.

Re: jQuery 3.6.0

#97
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…

jQuery is bundled in WordPress and many of the plugins so I guess there are a few sites still using it :)

Re: jQuery 3.6.0

#98

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.

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).

Re: jQuery 3.6.0

#99

Earlier quoted context omitted.

There's no need to complicate static sites with jQuery. All it does can be achieved with vanilla.

I tend to agree, and unless you have to support like IE prior to IE9 it will probably easily support all of your target browsers.

Promises aren't available in IE11, and as the last "true" IE, I imagine it'll be around a bit longer than it should be.

I recently had to rewrite a bunch of vanilla promise-based code to use jQuery promises once I realized IE11 didn't work.

Re: jQuery 3.6.0

#100

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.

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…

Just a nitpick, but querySelectorAll returns a NodeList.

This can bite at times, for example IE supports Array.forEach, but not NodeList.forEach

Post reply on HN