Live data from Hacker News

Just Use jQuery

twitter.com

11–20 of 41 posts

Re: Just Use jQuery

#11
I'm quite happy with Vue, and the Vue HTTP component loader so I don't have to deal with the build process in Python apps.

I also quite enjoyed Svelte.

I have very little interest in touching the DOM imperatively when a declarative option exists.

Re: Just Use jQuery

#12
I think a lot of people conflate "horrible state of web dev anno 2008" with "jQuery". At the time I heard coworkers talk about things like "oh, just make the variable public"; I had never heard of "public variables" in JS context before, but it wasn't my project and at the time I didn't know much about JS so I just assumed there was a gap in my knowledge. When I later took over the project I discovered that "public variable" meant "put window. in front of it".

I'm not saying jQuery or vanilla JS (which is the same thing, just a different API) is the end-all of everything, but with a bit of care and organisation it's not too hard to make dynamic "modern" sites and even web apps that are fast and can be maintained fairly easily. It is easy to make a mess of things though, as it doesn't guide you through a "framework" and especially in larger teams with different experience/skill levels this can be an issue.

At the end of the day I think this is a "Python vs. Ruby" type of discussion, where both can obviously work well, but both obviously also have their own strengths and weaknesses.

I dislike a certain section of the frontend crowd who thinks that going full-in on WebPack+React+TypeScript+1561 dependencies is the only possible way to build something useful and derides anyone who disagrees (at some point someone called me "the anti-vaxxer of frontend development" over this).

Re: Just Use jQuery

#13
post #8
post #5

Or just use vanilla JS

I like being able to do elem.remove() instead of elem.parentNode.removeChild(elem), and elem.prepend(other) instead of elem.insertAdjacentElement('afterbegin', other). There's loads of stuff like this. The DOM API does not spark joy.

Those exist now: https://developer.mozilla.org/en-US/docs/Web/API/Element/rem..., https://developer.mozilla.org/en-US/docs/Web/API/Element/pre...

Re: Just Use jQuery

#14
post #10

Earlier quoted context omitted.

Or just don't use JS

Modern CSS and HTML's built in elements are better at a lot of the things people use JS for. I think as coders we feel most comfortable reaching for JavaScript first, when really we should be doing as much in HTML itself as possible, then prettying it all up with CSS, and then finally adding some JS for interactivity such as client side form validation.

Indeed, and even a lot of client side form validation can be done using HTML and CSS: https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_va...

Re: Just Use jQuery

#15
post #13
post #8

Earlier quoted context omitted.

I like being able to do elem.remove() instead of elem.parentNode.removeChild(elem), and elem.prepend(other) instead of elem.insertAdjacentElement('afterbegin', other). There's loads of stuff like this. The DOM API does not spark joy.

Those exist now: https://developer.mozilla.org/en-US/docs/Web/API/Element/rem... , https://developer.mozilla.org/en-US/docs/Web/API/Element/pre...

Ah cheers, I didn't know that. I'll have to take a look.

Re: Just Use jQuery

#16
Reactive frameworks are the best. It is so much easier than having to handle events. I also find it way easier to work with a component based framework for complex UIs.

I have 2 production Svelte projects completed, and it is a charm to work with.

Re: Just Use jQuery

#18
post #8
post #5

Or just use vanilla JS

I like being able to do elem.remove() instead of elem.parentNode.removeChild(elem), and elem.prepend(other) instead of elem.insertAdjacentElement('afterbegin', other). There's loads of stuff like this. The DOM API does not spark joy.

[deleted]

Re: Just Use jQuery

#19

I'm quite happy with Vue, and the Vue HTTP component loader so I don't have to deal with the build process in Python apps. I also quite enjoyed Svelte. I have very little interest in touching the DOM imperatively when a declarative option exists.

I was a big advocate for “just use jQuery” amidst the JS framework hype ~10 years ago, but nowadays I agree that plain Vue hits a similar mark quite well.

Even just a naive approach of plopping a whole page in one big component or enhancing a page rendered elsewhere by mounting a few self-contained widgets on it is nicer than manually keeping track of state with events. Even my best an most concerted efforts at jQuery frontends eventually had many bugs that simply don’t happen with a declarative approach.

Re: Just Use jQuery

#20
post #14
post #10

Earlier quoted context omitted.

Modern CSS and HTML's built in elements are better at a lot of the things people use JS for. I think as coders we feel most comfortable reaching for JavaScript first, when really we should be doing as much in HTML itself as possible, then prettying it all up with CSS, and then finally adding some JS for interactivity such as client side form validation.

Indeed, and even a lot of client side form validation can be done using HTML and CSS: https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_va...

It’s pretty limited, though, and has some random quirks. Like a required field will be marked as invalid immediately on load, or that it’s not really possible to display multiple errors on a single input.

You can work around them, but you’re approaching the complexity of just writing your own validator by that point.

Post reply on HN