Live data from Hacker News

Bootstrap 5 will remove jQuery as a dependency

github.com

321–330 of 333 posts

Re: Bootstrap 5 will remove jQuery as a dependency

#321

Earlier quoted context omitted.

> Side benefit: also no weird $(thing)[0] when you need to use a DOM API, like HTML5 validity or whatever. But looping over querySelectorAll() is painful. I'm not really a frontend dev, so perhaps I'm doing it wrong, but this is the "easier" way I found when I was writing an app a few weeks ago (in TypeScript): // Get Array of HTMLElements from querySelectorAll(). let queryAll = (q: string): HTMLElement[] => { let no…

return Array.from(document.querySelectorAll(q));

This won't filter SVG elements, and unfortunately Array.from isn't available in IE (and perhaps some other browsers that are still in use).

Re: Bootstrap 5 will remove jQuery as a dependency

#322
post #171

Earlier quoted context omitted.

> Side benefit: also no weird $(thing)[0] when you need to use a DOM API, like HTML5 validity or whatever. But looping over querySelectorAll() is painful. I'm not really a frontend dev, so perhaps I'm doing it wrong, but this is the "easier" way I found when I was writing an app a few weeks ago (in TypeScript): // Get Array of HTMLElements from querySelectorAll(). let queryAll = (q: string): HTMLElement[] => { let no…

> But looping over querySelectorAll() is painful. Not any more: let elements = document.querySelectorAll('.some-class') elements.forEach(function(element){ ... }) https://developer.mozilla.org/en-US/docs/Web/API/NodeList/fo... PS. The other two answers here are outdated.

I should have explained the use case better: I need to store an indexed array of elements for cache/querying later on; so forEach() isn't a good fit here.

Other people suggested Array.from(), but that won't work in IE, and the polyfill for it is a lot longer/more complex than the for loop I wrote.

Re: Bootstrap 5 will remove jQuery as a dependency

#323

Earlier quoted context omitted.

> Every dependency removed from your website is a win. Sorry that this rant is hitting you, it's nothing personal, but this is somewhat a distraction. Deliver the slim version from your own host and with an existing HTTP connection and it's just 70 KB without compressed transfer. That's very little, even on mobile. People are regularly missing to optimize images and will easily transfer 100s of KB in image overhead o…

Its not just the bandwidth spent its the extra complexity of the code base. Every framework you add is an extra thing that devs have to know and in the future there will be less and less people who know jquery.

This assumes that nobody will learn "the old stuff" and only focus on the new stuff. I don't think that's how it works, otherwise we wouldn't see PHP in the wild anymore. Or anything else that's more than five years old.

On the other hand, people are integrating libraries for ANYTHING in their projects and don't care about that either.

Call me old-fashioned, but PHP + MySQL with HTML, CSS and a handful of jQuery has still brought me everywhere in terms of tech stack. Maybe I'm just doing shitty jobs, I don't know, but it works and the client is happy, so it doesn't look like a problem for me.

Re: Bootstrap 5 will remove jQuery as a dependency

#324
post #309

Earlier quoted context omitted.

I wish I could find it, but I read an article a while ago that showed how CDN-cached stuff usually, well, isn't. At the very least it's not something to rely on when making decisions about payload size.

It's cached at the CDN nodes, which means quick delivery to the device. This is much better than serving that file from your origin server, and even if you use a CDN it's unlikely that it'll match the hit rates of the public CDNs. That can make a measurable improvement, and at worse is no slower than hosting it yourself.

Have you benchmarked that? Each host you add has its own overhead thanks to DNS, TLS, etc. and every time I’ve done the tests, that cancels out the benefits entirely for a site which itself uses a CDN. I’ve also tended to see numbers for public CDNs which suggest that things aren’t cached as often as you’d like - maybe if it’s a popular project which hasn’t updated in years but otherwise version spread undercuts hit rates dramatically.

My rule of thumb is that public CDNs aren’t a performance move in the HTTP/2 era (i.e. 2016 or later). They may still be convenient, however.

Re: Bootstrap 5 will remove jQuery as a dependency

#325
post #288

Earlier quoted context omitted.

Look, I’ve replaced plenty of jQuery with vanilla JS. I’m totally on board for lighter, leaner pages. My point was simply that there’s this tedious cycle where people crap on the older tools and say everything is better across the board with the current hotness without actually measuring anything. There are a lot of cool capabilities we can use now but they’re only going to be better at the things you actually measur…

The "cool new stack", in this case, is native, vanilla javascript that works everywhere without downloading anything and without a need to learn someone else's library.

Or, if you actually read the thread you’re replying to, “modern frameworks” where none of that is true.

Re: Bootstrap 5 will remove jQuery as a dependency

#326

Earlier quoted context omitted.

That's a pretty obnoxious and unfounded opinion.

You seem to be ignorant in the matter. Go learn modern DOM methods, you will understand why you are so wrong.

I think table based layouts will make a comeback. I'm sure you agree, they make good containers for flexbox items. It's a Table, with data inside, so I can put whatever I like in a table, including functioning as layout. Can still be an accessible page, the table just replaces divs for structure, it's role clearly stated.

Re: Bootstrap 5 will remove jQuery as a dependency

#327
post #191

Earlier quoted context omitted.

I will swear on my life that I haven't used a style attribute in the last five years. Since I started using BEM for namespacing I have had a very easy time keeping my CSS clean and maintainable. I won't deny others their opinions, though.

BEM is a decent convention for old-school, global document styling, in the absence of scope. But it's also manual, error-prone, and verbose, making it a poor substitute for actual namespacing provided by components. I sympathize with your resistance to css-in-js; I've been doing webdev since 1998 and only really embraced it in the last couple years. I'm reminded of quotes like "The difficulty lies not so much in new…

Fair enough. I felt the same way about JSX when it came out so maybe I need to give it another look. :)

Re: Bootstrap 5 will remove jQuery as a dependency

#328

Earlier quoted context omitted.

A single stable identifier would've solved the whole situation and Apple already had it with Advertising ID. Exposing that to the browser would've been enough so Safari could've been ahead of the curve.

Yeah, all you need to do is include a persistent identifier shared across all sites in the world! In fact, this solution is so great you don’t even need cookies anymore and you never get logged out if you accidentally delete them!

Is this sarcasm? The Advertising ID system is from Apple and in use in all apps, and it can be reset at anytime. It increases privacy, security, and efficiency.

Re: Bootstrap 5 will remove jQuery as a dependency

#330

Earlier quoted context omitted.

When the wheel is prone to damage from small bumps, and can't handle off-road, a new stronger reliable wheel that handles all terrain is needed. That's what Jquery offers.

And when the wheel is so bloated the car can barely make it down the road without needing to refill the fuel tank a new more lightweight reliable wheel that can handle modern terrain is needed. That is why people are moving away from Jquery.

Oh, just take your hatred elsewhere!
Post reply on HN