Live data from Hacker News

I loved jQuery, and still do (2019)

withblue.ink

51–60 of 189 posts

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

#51

Earlier quoted context omitted.

To use an example, I'd much rather do $(".elements").css("color", "red") versus var selector = document.getElementsByClassName('elements'); selector.style.color = 'red';

You can do const $ = document.querySelector; $('.elements').style.color = 'red'; Which is only marginally more verbose.

No you can't. $('.elements') in jQuery is more equivalent to querySelectorAll('.elements').

You can however do:

document.querySelectorAll('a').forEach(a => a.style.color = 'red')

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

#52

Earlier quoted context omitted.

30kb is pretty trivial. And even so, if you are using a CDN like you should the jQuery is likely already cached on the user device.

I recall an earlier discussion on here stating that using CDN nowadays doesn't have any gains, only drawbacks.

This is correct. It's called cache partioning. https://developers.google.com/web/updates/2020/10/http-cache...

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

#53

I've depended on jQuery, not a strictly front end designer myself but have done a bit of client side dev the past 20 years. If I had a choice, I'd go with one of the reactive libraries, I've used Vue. For me, if you're relying on Javascript IMO it gets the job done quicker. It'd be interesting to see what jquery is used for in aggregation of all its usage. For me it was always selecting element(s) and XHR requests. W…

I've never been a UI dev, but have frequently been forced to put a UI as a PoC that becomes production UI. ugh. I had always turned to JQuery just for the browser compatibility aspect. I got out of the game for a few years and have recently gotten back on the that horse. I turned to JQuery as that's what I knew. Now that supporting IE is no longer a thing, and since modern JS essentially includes the missing pieces JQuery filled. I am slowly converting to plain JS in aims of removing JQuery.

I am awaiting my fetches with async functions in place of $.ajax with MDN pages in the next tab. Don't see how replacing one library of JQuery with another library like Vue/React/etc is any better. A crutch is a crutch by any other name.

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

#54
post #45

I still use jQuery even for new projects. Yes, these days it's possible to do everything jQuery does using native JS, but I find the native version to be much more verbose and its naming conventions to be far less clear. For example, natively getting a list of children is `el.children` but natively getting the parent is `el.parentNode`, not `el.parent`. Meanwhile, natively getting a list of classes is `el.classList`,…

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).

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

#55
I finally learned some React a couple of months ago on the premise that as a designer, I needed a better understanding of the frameworks used by the developers I work with.

I know React enforces some better practices that my spaghetti-jQuery of yore never followed, and that I was getting a crash course in those practices at the same time, but I was nonetheless surprised at just how slow I felt working in it! It gave me a new appreciation of just how accessible jQuery is, and how intuitive its concepts are to someone without a background in software development, perhaps for better or worse.

Obviously this is a bit of an apples-to-oranges comparison, given the intended uses of the two frameworks, but for simple projects, it's hard to imagine a better balance of accessibility and flexibility than jQuery.

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

#56
post #48

I had a big post but deleted it all. I can more concisely say this: The people here saying they still use it have so far demonstrated what I always say. If you're using jQuery, it's time to go back and relearn javascript. Most people should REALLY research the querySelector and querySelectorAll DOM methods. I've always felt that jQuery encourages you to let your skills stagnate and you don't learn what your code is a…

For new projects I agree. Go jQuery-less. But for existing projects that still work well and for which there is no reason or gain from updating the code and, for which, time and money would be spent for what is really a lateral move, I think it's fine to leave it as is. And there are many projects like this where the JavaScript barely changes, jQuery is holding it in place and nicely and there's hardly any technical…

I agree. No need to go into something that exists and do a big refactor to pull it out. I'm advocating for not adding it to things you start now.

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

#57

I had a big post but deleted it all. I can more concisely say this: The people here saying they still use it have so far demonstrated what I always say. If you're using jQuery, it's time to go back and relearn javascript. Most people should REALLY research the querySelector and querySelectorAll DOM methods. I've always felt that jQuery encourages you to let your skills stagnate and you don't learn what your code is a…

I disagree, jQuery is still nice for some complicate dom manipulations and still simplify it a lot. Of course I'm not saying you can't do that without it, but saying if you use jQuery you doesn't know JS doesn't make sense.

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

#58
I definitely agree with jQuery's legacy. We owe many parts of modern DOM and JavaScript to jQuery and Prototype.js (may I say that Prototype.js was to JavaScript what jQuery was to DOM).

There is probably no reason today to use Prototype.js, however, jQuery still is a better choice than React/Angular/Vue for small projects if the author prefers some syntactic sugar over plain DOM.

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

#59
Do people still hate jQuery? I feel like the consensus is that that jQuery was a great tool for the time, but is not so critical today.

Yeah, we've all seen spaghetti code monstrosities that involve lots of jQuery, but it's just a library, it can't be blamed for people not knowing how to structure their code.

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

#60

Django templates + Bootstrap + jQuery is all I've ever needed to make great, modern websites. Server-side rendering with some nice layouts and interactivity on the frontend. I've tried some of the SPA frameworks and I've always felt like my productivity tanked.

Do you develop REST API also....? The fundamental issue is that it binds the server to the client, who must understand HTML structure. It also makes it more difficult to reuse the endpoints in different ways or for new applications. Returning data and letting the client render it decreases coupling and increases flexibility/testability- you can run unit tests on the client for mock data, and run unit tests on the ser…

I don't use Django but I use Ruby on Rails, and turning a server-side rendered page into an API is trivial. Rails requests automatically understand the format of a request and let you specify what do when a specific kind of format comes in: ie. when it's an html request, render this page, when it's a "js" request, render a jbuilder template. ezpz

whatever frontend framework you're using has really nothing to do with it at all.

Post reply on HN