Everyone here seems to be talking about how great jQuery was for DOM interaction and that's true. But the other thing that was life changing about it was how easy it was to make ajax requests!
But the other thing that was life changing about it was how easy it was to make ajax requests! What's the "modern" alternative to jQuery in that regard? I don't do much JS development, but if I needed to make an AJAX request today, my first instinct would probably still be to use jQuery.
Gov.uk drops jQuery from their front end
331–340 of 458 posts
Re: Gov.uk drops jQuery from their front end
#332Earlier quoted context omitted.
This is a fair criticism of how I chose to tell the story. The line you quoted was supposed to refer to the character introduced in the second paragraph and not to a generic stereotype of aged man. I can see how my choice of wording created an implication that people who have grey beards are old and that it is this oldness that contributes to their unwillingness to learn. The familiar cliche of "you can't teach an ol…
I'm curious: what's replaced Query? I guess it's not a single library, but a set of frameworks...
Re: Gov.uk drops jQuery from their front end
#333Earlier quoted context omitted.
> is it terribly worse than some other way? Yeah, it's fragile and will easily lead to bugs when someone changes the markup without realizing it's going to break some crazy selector in another part of the code. It would make a lot more sense to just add a class to the element you're trying to select.
it's a conditional select, you're saying just add code to add/remove a class to the target - of course, but that defeats the point of wanting a conditional selector in the first place
Look, if you need this for some one off thing and you've determined it's the best way to do it in this special case, it's not hard to create a function that will find the element you want.
It's not a good argument for using jQuery IMO, because if you're doing this regularly there's probably a better way to do it.
But coming soon™ you will be able to do even this with `document.querySelector`.
Edit: I didn't pay close attention to your second example. I was speaking mostly related to the a:has example before. Your second example seems to be something that would be desired more in CSS than JS, and I don't think it's unreasonable to do that in CSS. If you need to do it in JS you can workaround browser limitations just fine by writing more than one line of code to do the selection and test the condition.
Re: Gov.uk drops jQuery from their front end
#334Earlier quoted context omitted.
I think it's just for brevity, rather than because a helper is needed . OP listed the entire source code of their module in their comment.
Brevity is cool, but that's kind of like naming all your variables one letter chars for brevity. This is something every web dev will instantly know what it does: document.querySelectorAll('#rabbit .green').forEach(tag => { }) Whereas this is something nobody knows what the fuck it is because it's completely non-standard. for (const rabbit of dqsA('#rabbits .green')) { } And get what, 10 characters less in one row? B…
All they did was alias `dqsA`. If anything, it's the fn name that could be better.
Re: Gov.uk drops jQuery from their front end
#335Earlier quoted context omitted.
what do you mean by "wasteful"?
Creating an array, populating it with however many elements just to be able to call some methods and destroying it immediately afterwards. And doing it all over the app, just because it's syntactically convenient. (all while you already have an iterable collection in the form of NodeList)
Not sure why it caught on.
Re: Gov.uk drops jQuery from their front end
#336Earlier quoted context omitted.
You can extend HtmlElementCollection prototype with any methods you like. (it's NodeList, btw, what's returned from querySelectorAll)
My understanding is that mutating built in prototypes is very bad. Not just for interop reasons, but because doing so really hinders many optimizations javascript engines perform.
Re: Gov.uk drops jQuery from their front end
#337When I first started programming I was pretty lucky to get a job at a games company. My first lead was a veteran who had shipped a lot of AAA titles and he loved his war stories. He was personally interested in performance and he would often cite hardware timings for specific cpu instructions. One story he told a couple of times was about some grey beard who was before his time. The grey beard was once a legend in th…
The assembly tricks got obsoleted because they're not needed anymore - we simply don't program in that hardware anymore.
jQuery still works fine to this day. It's just that engineers don't like it anymore. The same will happen to React in a few years.
I wouldn't hire a jQuery developer for working in a cushy company with their millions and their React codebases - React knowledge is actually one of the things we test for (and, unexplainably, one of the few exceptions we'll allow to avoid knowing about algorithms and time complexity).
If I had to build something with my money on the line, I'd definitely pick the jQuery veteran.
Re: Gov.uk drops jQuery from their front end
#338AFAIK (I'm not a front-end dev but tried some) vanilla JavaScript has much of the things jQuery provided built-in nowadays yet they look much longer. Now as JavaScript accumulated a lot of legacy stuff only kept for compatibility + also numerous verbally/syntactically sub-elegant APIs IMHO it is time to design a language which would simply be "better JavaScript" - clean, modern and elegant yet have no fundamental dif…
> design a language which would simply be "better JavaScript" - clean, modern and elegant yet have no fundamental differences JS' problem is that it is fundamentally not "clean, modern and elegant". It was designed in a couple of days. And all the greatness that's added to it nowadays is done in a much better design process than at it's inception, yet some choices made at it's inception can never be reversed. I've wr…
Re: Gov.uk drops jQuery from their front end
#339Earlier quoted context omitted.
It was just a reference to the person in the story, not an allusion to "because he was old he didn't try to update his knowledge/continue learning".
So why describe him as a "greybeard" then? It are you claiming to have met many younger and/or female 'greybeards'? If your answer is that 'it's just part of the story'. Well that's precisely the complaint.
Greybeards is an inclusive term and it's a well known term.
Re: Gov.uk drops jQuery from their front end
#340Earlier quoted context omitted.
> But to me, they are like the old grey beard who didn't update his knowledge as the times changed. Maybe it's just me but with all the rampant age discrimination nowadays in tech, I really don't like to see the continued propagation of this stereotype. All sorts of people of all ages are unwilling or unable to update their knowledge of new tech, there is no reason to link this characteristic to someones advanced age…
This is a fair criticism of how I chose to tell the story. The line you quoted was supposed to refer to the character introduced in the second paragraph and not to a generic stereotype of aged man. I can see how my choice of wording created an implication that people who have grey beards are old and that it is this oldness that contributes to their unwillingness to learn. The familiar cliche of "you can't teach an ol…
To try to shoehorn this back into the compiler analogy, modern frameworks would be like the advanced, complex and opaque compiler, and the grey beard is the guy that understands how stuff like HTML streaming and font download prioritization and hidden classes affect performance, whereas the team lead is analogous to the run-of-the-mill bootcamp grad that knows how to use the framework-du-jour but is way out of their depth if venturing outside the comfort of the framework and into the depths of those advanced topics.
And I think the gov.uk use case here might actually be an outlier in the sense that it actually considers performance of an already tight codebase, whereas a lot of jQuery deprecation efforts bring with them heavier alternatives in the name of maintainability or developer productivity or hiring or whatever. To be clear, many of these concerns are quite valid, but it seems a bit disingenuous to create a false dichotomy between understanding of low level concerns vs concerns about SDLC management. They aren't mutually exclusive.