Live data from Hacker News

jQuery 3.6.0

blog.jquery.com

281–290 of 292 posts

Re: jQuery 3.6.0

#281

Earlier quoted context omitted.

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.

We just don’t bother supporting IE11.

you are probably in smaller company. still at least 1 percent of users use it. 1% of revenue increase in big companies is substantial amount of money

Re: jQuery 3.6.0

#282

Earlier quoted context omitted.

What I don't understand is why the modern js api didn't just adopt query's conventions... they're so much nicer and more expressive most of the time.

They cannot. If they do and remove the old getelementbyname, etc, then it will be breaking change. If they just add $ notation, then there will be redundancy / inconsistency with existing api. Furthermore it will break / confuse apps which use jquery. Then it's far easier to just include minified jquery into your apps when you want to use it, and you have more control about it's version, etc.

I'm not saying to use $, but the elegance/composability of jQuery could have been implemented as they updated the API. And deprecating getelementbyname etc could have been done over a long period.

Re: jQuery 3.6.0

#284

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

Yes but if you’re not using the latest JS framework how do you get girls.

Upvote. Made me literal lol.

Re: jQuery 3.6.0

#285

Earlier quoted context omitted.

At Work, we‘re building web applications that need to be accessed by hundreds of editors with thousands of pages. Most of them share an essential bundle of components. Are you telling me a project that complicated can be built using just jquery? Also, what‘s bad about typescript?

The number of clients accessing the page has no bearing on the best framework to use. The number of pages on the website is also not that relevant. If 400 people are accessing 10,000 static pages, don't use any js at all.

I couldn‘t disagree more. It‘s a user portal managing thousands of different interactions and workflows, based on the users existing information. Most of them can be edited live with a content-management-system by an editor. These workflows are very hard to reason about with just jquery or nor js at all.

Re: jQuery 3.6.0

#286

Earlier quoted context omitted.

At Work, we‘re building web applications that need to be accessed by hundreds of editors with thousands of pages. Most of them share an essential bundle of components. Are you telling me a project that complicated can be built using just jquery? Also, what‘s bad about typescript?

It can, sure, but having coding conventions is essential, which those frameworks/linters help to enforce. But we've been doing projects with millions of pages way before React :) Checkout Wikipedia, which, by the way, uses jQuery, of course. And PHP. >Also, what‘s bad about typescript? It tries to turn the very dynamic JavaScript into something it will never be and no amount of contortion can hide it. Unless it stops…

Wikipedia is a largely uniform, read-only, static experience. These days people want app-like experience on the front-end. Can‘t manage them with jquery.

The bit about typescript is true at runtime. However, Typescript is also good documentation for developers.

Re: jQuery 3.6.0

#287
post #276
post #253

Earlier quoted context omitted.

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.

You can, of course, make it more robust, like: 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.

Yeah, but 19 helper functions later and you've got half of jQuery. I'd rather use a properly tested library.

Re: jQuery 3.6.0

#288
post #235
post #136

Earlier quoted context omitted.

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

You can also create a getter on NodeList.prototype named '_' that returns Array.from(this) and then just use any of the array methods on it. Like

    document.querySelectorAll('div')._.some(...)
So many options. :)

Re: jQuery 3.6.0

#289
post #264
post #124

Earlier quoted context omitted.

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

You should totally open-source that, put it on NPM, and write an article or so about it.

Everyone will have different set of methods they use. Point of this is that if you need some method you can just add it in in 4-5 lines or remove one you don't need. So it's not the best fit for NPM. It's good fit for good old copy/paste into a project, if you're optimizing for size/memory use. :)

Re: jQuery 3.6.0

#290

Is jQuery worth learning in 2021? I 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 manipu…

If you’ve been doing web dev for 2 years you can pick up jQuery in an evening. Go do it. You might never need it but learning is fun and understanding what jQuery is instead of hearing about it’s flaws on HN is a good idea.
Post reply on HN