Earlier quoted context omitted.
> jQuery is ≈30k gziped and most likely already cached from CDN. This part isn't so true in reality anymore, due to revised browser caching systems[1]. Doesn't mean you shouldn't use jQuery, just that part of the benefits of a centralized CDN are no longer a factor and it's a lot more sensible to self-host. 1: https://www.stefanjudis.com/notes/say-goodbye-to-resource-ca...
Right you are. But jQuery is around the same size as Vue, and that's the lean alternative to React. So the “jQuery is bloat” argument still doesn't make much sense. A single retina hero banner is larger than most JavaScript libraries/frameworks.
jQuery 3.6.0
271–280 of 292 posts
Re: jQuery 3.6.0
#272Do 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. Everyday. Still love it. >…Javascript document api via document.querySelector, and document.querySelectorAll The jQuery API is still (and probably aways will be) far superior to the native DOM (terser, composable, more expressive, etc). >…smaller footprint libraries like lodash jQuery is ≈30k gziped and most likely already cached from CDN. >…has fallen out of favor of more compreh…
Heck, even Slack was built with jQuery the first time. Only after a while they migrated to react.
Re: jQuery 3.6.0
#273Do 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…
Re: jQuery 3.6.0
#274Re: jQuery 3.6.0
#275Do 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…
Re: jQuery 3.6.0
#276Earlier quoted context omitted.
I know it doesn't replace jQuery, but this is fairly straightforward: $ = document.querySelector.bind(document) $$ = document.querySelectorAll.bind(document)
It's annoying that it returns a NodeList which doesn't have some common array-y methods and the like. While these aliases are certainly convenient, the jQuery semantics are much nicer and more intuitive IMO.
function $$(sel, parent) {
var nodes = (parent || document).querySelectorAll(sel);
return Array.prototype.slice.call(nodes, 0);
}
Similarly, you can get rid of $$ and fold it all into $, etc. I was trying to be concise in the original response.Re: jQuery 3.6.0
#277Earlier quoted context omitted.
> It all seems so crazy to me, but this ship has long sailed. Nope. And it's why Svelte is something that I've been hard adopting because it looks the closest to old-school JS/CSS/HTML while still bringing some of the same capabilities over that I love from React and VueJS. It also runs without a VDOM or a constantly running event loop - both things are incredibly attractive to me. Although it's not a perfect solutio…
I really, really hate the JS toolchains like "Webpack + TS + React + eslint + Babel etc etc" that you mentioned. I rather like Svelte. But honesty requires that we recognize that Svelte also uses Webpack/Rollup + TS + Svelte etc etc. I like the idea of Snowpack. But if A.svelte and B.svelte both use C.svelte, Snowpack has to do a lot of redundant work to provide A.js and B.js with Svelte.js and C.js all converted aga…
Mileage will vary =)
Re: jQuery 3.6.0
#278Re: jQuery 3.6.0
#279Earlier quoted context omitted.
"The jQuery API is still (and probably aways will be) far superior to the native DOM" The jQuery API really is so well done. I stopped using jQuery, but implemented a simple script (jSugar.js) that exposes many basic jQuery things but is really just a wrapper for native DOM operations. It only operates on individual DOM nodes. Any looping should be done using your JS loop of choice (forEach, for loop, which, etc). Th…
> The jQuery API really is so well done. I stopped using jQuery, but implemented a simple script (jSugar.js) that exposes many basic jQuery things but is really just a wrapper for native DOM operations. so... like jQuery?
Re: jQuery 3.6.0
#280I started studying web development 2 years ago and I never feel the need to reach for jQuery. From the very beginning I wanted to get a solid knowledge of front end technologies without libraries or frameworks. After working for some time in this field I do feel the need for stuff like Bootstrap, Tailwind, Vue/React, but not jQuery. What's is selling point considering that DOM manipulation and HTTP requests has improved over the years in vanilla JS?
I've read through most of the comments and I see a lot of:
I'm used to jQuery syntax
$ is shorter than document.querySelector
jQuery provides better support for older browsers
First two aren't really meaningful to me, and for the last one, I'd say if you care about browser support you are probably compiling your code anyway.
I'm not familiar with using jQuery but I work with people that use it and I've realized it promotes some bad practices like:
Repeated DOM node selection due to the ease of use of $(selector)
Manipulation of CSS that should be done in CSS
jQuery is not JavaScript. Some people use it as a crutch and it shows
So my main question, if someone is comfortable with vanilla JS, does it make any sense learning jQuery?