Live data from Hacker News

I loved jQuery, and still do (2019)

withblue.ink

181–189 of 189 posts

Re: I loved jQuery, and still do (2019)

#181

Earlier quoted context omitted.

> Fetch API would make it vastly shorter (`data = await (await fetch('/my/url')).json()`—as an aside, suffix await like Rust settled on is so much nicer: `data = fetch('/my/url').await.json().await`); const data = await fetch('/my/url').then(r => r.json());

Hmm, forgot about that style. Where you only have prefix await, .then() can end up nicer (though I might split it into `const response = await fetch('/my/url'); const data = await response.json();` as yet another style), but if you can have suffix await, I reckon it’s much nicer. Goes well with fluent API styles.

> Hmm, forgot about that style. Where you only have prefix await, .then() can end up nicer

Mind that in this example the then is a little nicer only by chance that the continuation is quite trivial. If you'd need something more complex than the single function call it is annoying and if you do any later change to this code, you likely have to change this as well.

I typically go to the multiple lines, but wanted to show that there is a kind-off suffix await.

I am not used to suffix await, as i like to spot the places where i jump out of the coroutine easily. But maybe that would change if I'd use languages with suffix await more :)

Re: I loved jQuery, and still do (2019)

#182
NO, you can't use jQuery!! It's against the law!!! (proceeds to build non-interactive static page with create-react-app)

I find jQuery and Bootstrap great for fast prototyping. The thing I love about jQuery is the cross-browser compatibility. I know things have improved but I have very little faith in native JS "just working" as I would expect on all browsers.

But of course it was not designed for building reactive apps and so should not be used for that. It's nice just for fast-and-dirty UI interactions and animations.

Re: I loved jQuery, and still do (2019)

#183
post #149
post #129

Earlier quoted context omitted.

> Is this supposed to be making the case ~against~ jQuery? It's supposed to be making a case against jQuery if you're pulling in the whole library just to do this one thing. I've always read the site as "here's how to do it in native JS, yes it's uglier, but if you only need this, you can skip pulling in another dependency."

We use React, Angular and Vue for websites where 99% of the functionality could be done without monstrosities like CSS-in-JS. Over-engineering websites has been around forever. That's partially why jQuery is modular, letting you pick what you need.This covers the 'use jquery for just this one thing' crowd. And if they're lazy, well, they can hang their heads in shame because they have added an entire 83 KB to the pag…

note that browsers' cache has recently been changed so that it's isolated for each origin - if you visit a.com which loads jQuery, it doesn't speed up loading jQuery on b.com at all https://developer.mozilla.org/en-US/docs/Web/Privacy/State_P...

Re: I loved jQuery, and still do (2019)

#184

I guess it's easier to remember $ than queryselectorall . I recently realised most of its methods are now natively supported. I think people who don't use js a lot may not realise that.

in many ways jQuery has a lot of developer friendly niceties, in a different timeline jQuery became the new standardized DOM API and everyone would be happy

Re: I loved jQuery, and still do (2019)

#185
post #131

Earlier quoted context omitted.

I've used jQuery in the past, but switched to native js/ts. I found that while jQuery offers some nice synthetic sugar, it's mostly geared towards web frontend and actual logic continue to have to reside in native. I'd rather just know one thing (but I'm a backend programmer that only does js/ts for fun, so there's that).

Mostly geared toward frontend? It’s been a while since I used JQuery but I thought it is specifically a frontend library.

Maybe they mean UI?

Re: I loved jQuery, and still do (2019)

#187

Earlier quoted context omitted.

I'm the author of the post. I was not expecting this to surface out of the blue 2 years later, so I had to go back and re-read what I wrote I still stand behind what I wrote for the most part. If what you are looking for is not building a full SPA and you need compatibility with most browsers, for most users, then jQuery is still a very solid alternative. A few things have changed however since then: - As others have…

Right, not expecting this to surface out of the blue 2 years later , OP. Thanks for the addition insights anyways

I'm not the OP.

Re: I loved jQuery, and still do (2019)

#188
post #74

Earlier quoted context omitted.

I respectfully disagree. If you take 15 min to understand the basics it becomes trivially easy and the productivity you gain going forward is massive.

I've been dealing with Webpacker for almost a year and it's been a nightmare every time I've tried to use it. And yes, I did sit down and try to figure out what the hell was going on.

Vite is the way to go now, IMO. It just works and is extremely fast.

Re: I loved jQuery, and still do (2019)

#189

Earlier quoted context omitted.

Confirmed this is also trivial with Django, have done it to my crud, and even have a view that parses my url router for views and return an openapi definition with a swagger ui.

Do you use Django REST Framework with Web Swagger Console UI?

Nope, I have a view that parses my url router for views and generates an openapi schema, and a view that shows a swagger with it.
Post reply on HN