Live data from Hacker News

jQuery 3.6.0

blog.jquery.com

231–240 of 292 posts

Re: jQuery 3.6.0

#231
post #163

Earlier quoted context omitted.

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.

A lean alternative to React would be preact.

Or mithril

Re: jQuery 3.6.0

#232

Earlier quoted context omitted.

I'm exactly arguing against this Webpack, Typescript, React, etc approach to web development. I'm more productive in PHP + jQuery, a lot due to familiarity, of course, but I'm also a huge believer in a simple stack. If you've 20+ mutually dependent inputs, maybe you need a better UI, not a complex state management framework. If your browser is ultimately executing an untyped crazy dynamic language, is it worth trying…

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

what runs with a 'constantly running event loop' exactly?

I can't think of a single framework that does this, (its neigh impossible, actually, it'll just lock up your browser)

Svelte is cool, but this statement needs some serious proof

Re: jQuery 3.6.0

#233

Earlier quoted context omitted.

That argument stands true for most frameworks on most platforms. I prefer the dollar sign; it's pervasive and concise.

I disagree. There's nothing about React, Vue or any other framework that I'm aware of that does anything similar to jQuery's dollar sign. The only magically-looking abstraction I can think of is JSX, and that's not only not mandatory but very obviously something that's off the curve. Unlike the dollar sign, which just looks like a special construct of the language.

Svelte uses the dollar sign. https://svelte.dev/tutorial/reactive-declarations

Re: jQuery 3.6.0

#234

Earlier quoted context omitted.

>most likely already cached from CDN. I don't believe any major browser allows sites to share 3rd party caches anymore. Previous HN discussion: https://news.ycombinator.com/item?id=24894135

True, there is still a perf win however since CDNs are located geographically closer to a global consumer than keeping the libs on your own box.

Self-hosting is no longer the performance drain it used to be now that HTTP/2 is a thing, as soon as the browser parses the page, the JS file is only 1 RTT away. Using a CDN for a single asset like jQuery requires a DNS lookup, TCP connection and TLS negotiation - that's 3 RTTs plus unknown latency from the user's resolver before the HTTP request is even sent. The performance difference in the single request scenario is likely negligible and the benefits of not relying on a 3rd party can outweigh the latency savings.

Re: jQuery 3.6.0

#235
post #136

Earlier quoted context omitted.

I'm trying to wean off of jQuery to reduce dependencies, but it makes me appreciate jQuery all the more. The native JS API is quite a bit more verbose and cumbersome to use, and my absolute biggest gripe with it is that it doesn't even build on modern JS features. It's not compatible with for...of, map, filter, find, etc, which seems really strange for a relatively recent vanilla JS API. Ironically, http://youmightno…

You can easily extend NodeList.prototype with Array.prototype functions you like, and then just use them: ['map', 'find'].forEach(f => NodeList.prototype[f] = Array.prototype[f]); document.querySelectorAll('bla').map(el => whatever) That's what prototypes are for, anyway.

Nice,

  ['map', 'find', 'filter', 'reduce'].forEach(f => NodeList.prototype[f] = Array.prototype[f])
  // this is for for..of, cannot be above 'map', 'filter' etc.
  NodeList.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator]
  document.querySelectorAll('span').map(el => console.log(el))
  document.querySelectorAll('span').filter(el => el.className === 'fc-black-500').reduce((acc, el) => (acc += el.className, acc), '')
  for(let p of document.querySelectorAll('p')) { console.log(p) }
- https://stackoverflow.com/questions/30836289/for-of-loop-que...

Re: jQuery 3.6.0

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

Still use jquery. Just look at any of the "you don't need jquery" sites to see how verbose even modern JS is for many simple dom manipulation tasks.

Re: jQuery 3.6.0

#237
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.

BTW, NodeList.prototype.forEach is not available on every browsers that supports querySelector/querySelectorAll, such as IE11: https://caniuse.com/mdn-api_nodelist_foreach

So you need to be careful about writing code like that if you want to avoid jQuery.

Re: jQuery 3.6.0

#238
post #233

Earlier quoted context omitted.

I disagree. There's nothing about React, Vue or any other framework that I'm aware of that does anything similar to jQuery's dollar sign. The only magically-looking abstraction I can think of is JSX, and that's not only not mandatory but very obviously something that's off the curve. Unlike the dollar sign, which just looks like a special construct of the language.

Svelte uses the dollar sign. https://svelte.dev/tutorial/reactive-declarations

Wow, that looks weird. Thank you, I hadn't heard of Svelte before.

Re: jQuery 3.6.0

#239

Earlier quoted context omitted.

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.

> and that's the lean alternative to React. Ahem https://preactjs.com/

oh look, another one. lol

Re: jQuery 3.6.0

#240
post #132

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

From your FAQ > No. Prices will never increase. Unlike other companies, we will never shutdown our service either. How can you guarantee this?

There are only two ways I think this can work.

Their price completely covers every user signed up at any scale. If they lose all but 1 customer, that customer can keep the lights with just their subscription.

The other is that company has such a large warchest it'd be impossible to run out of money.

Post reply on HN