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.
jQuery 3.6.0
281–290 of 292 posts
Re: jQuery 3.6.0
#282Earlier 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.
Re: jQuery 3.6.0
#283Re: jQuery 3.6.0
#284I'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.
Re: jQuery 3.6.0
#285Earlier 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.
Re: jQuery 3.6.0
#286Earlier 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…
The bit about typescript is true at runtime. However, Typescript is also good documentation for developers.
Re: jQuery 3.6.0
#287Earlier 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.
Re: jQuery 3.6.0
#288Earlier 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),…
document.querySelectorAll('div')._.some(...)
So many options. :)Re: jQuery 3.6.0
#289Earlier 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.
Re: jQuery 3.6.0
#290Is 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…