Live data from Hacker News

jQuery 3.6.0

blog.jquery.com

61–70 of 292 posts

Re: jQuery 3.6.0

#61

Earlier quoted context omitted.

> This has been rolled into the Javascript document api via document.querySelector, and document.querySelectorAll. Have you actually compared the two methods in a real website? It's like saying why use Ruby when you can use Java. The Javascript document API is super verbose. No thanks.

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.

Isn’t your example a type error. JQuery’s operations auto-broadcast over the lists of elements it returns whereas the native methods don’t

Re: jQuery 3.6.0

#62
I no longer use jQuery nowadays due to React/Stimulus but one nice thing about jQuery is ability search for an element in a DOM note and append html. You can do it with raw JavaScript but jQuery API is light years ahead.

Re: jQuery 3.6.0

#64
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 are still a ton of legacy sites that use it. New development? Don't know, but the last 2 companies I worked for had massive systems written in JQuery.

Re: jQuery 3.6.0

#65
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 like jQuery because:

- The API is still more concise than what is built into the browser (Compare the number of lines used here: http://youmightnotneedjquery.com/)

- It is still useful for older browsers that might not support something.

- The API is burned into my brain, it speaks jQuery.

- If I have any issues, Google will usually surface how to use the API faster than the (standards compliant API * can I use it?)

I do use React for UI, but sometimes you have to interact with the DOM; in those cases for larger programs I find jQuery easier to read and write.

Re: jQuery 3.6.0

#66
post #54

Earlier quoted context omitted.

I never understood why people say “We’ve solved your jQuery problem” by introducing getElementsByClassName() or even querySelector(). When I come back to my older app, $(“.my-class”) is still much nicer. jQuery gets out of the way, the class gets syntax-highlighted, and .focus() can’t create an NPE.

I know it doesn't replace jQuery, but this is fairly straightforward: $ = document.querySelector.bind(document) $$ = document.querySelectorAll.bind(document)

Using this since ages. Also use window.DOM = document

Re: jQuery 3.6.0

#67
post #47
post #32

For those wondering, JQuery is still used on the majority of web sites in the world apparently [1] I'm not sure how the data is run, but it's quite massive share however you cut it. JQuery is still in it's foundational phase, it's still a 'core' thing, it's not remotely legacy yet. [1] https://almanac.httparchive.org/en/2019/javascript

A lot of them are probably due to Bootstrap (<5.0) bundling it.

And WordPress, even current versions.

Re: jQuery 3.6.0

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

> This has been rolled into the Javascript document api via document.querySelector, and document.querySelectorAll. Have you actually compared the two methods in a real website? It's like saying why use Ruby when you can use Java. The Javascript document API is super verbose. No thanks.

> The Javascript document API is super verbose.

Can't say I've ever heard that as an issue before..

Also I think the main point was there are so many better frameworks that manage the DOM better than jQuery as the need has evolved. I'll always have fond memories of jQuery but I don't see it as my go-to anymore, by a long shot.

Re: jQuery 3.6.0

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

> 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/

Re: jQuery 3.6.0

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

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