Live data from Hacker News

You might not need jQuery

youmightnotneedjquery.com

121–130 of 360 posts

Re: You might not need jQuery

#121
post #57

No, please no. If size is an issue for some reason or you want to have no dependencies you can use something like http://zeptojs.com/ and just embed everything in one minified file. If you do things right only the functions you are actually using will get placed in there as well. Do not reinvent the wheel to solve problems that can't be solved in much cleaner and nicer ways. Managing dependencies can be annoying, but…

Isn't the point here that JQuery is reinventing a lot of core JavaScript stuff? It isn't reinvention if it is already there.

JQuery has down sides other than size. There is also maintenance, dependency and backwards compatibility issues.

EDIT: Plus it adds a lot of extra syntactic mess, extra () $ and .

Re: You might not need jQuery

#122
post #106
post #75

Earlier quoted context omitted.

You don't need an abstraction to do something that's natively implemented on your platform.

Right, because why have "var x = 2+2" when you have perfectly maintainable assembly!

I think the point is that "$.contains(el, child)" is not a useful abstraction of "el.contains(child)".

Re: You might not need jQuery

#123
jQuery or is one of the few things I don't have to think twice about before including in EVERY WEB PROJECT I EVER WORK ON before doing anything else.

Next up: you might not need .

Really?! What does "need" mean? Go write assembly.

Re: You might not need jQuery

#124
post #92
post #51

Earlier quoted context omitted.

i do Enterprise work & if we have jQuery in a page IBM dismisses our PMRs when we submit issues. So yeah I regularly include some simple cross-browser-normalizing js functions to use with the vendor-approved libs. Also, jQuery is not trival to use in conjunction with other js libs (Dojo) as namespacing proponents claim. It's not like you just include both & they don't interfere. You have to follow a specific initiali…

I don't understand this comment - I'm not suggesting you should use jQuery or nothing, or jQuery and Dojo. My point is the reasons given in the post for not using a DOM library of some sort are not valid.

o ok i was taking your comment within the context of the post -- more like "why not allow jQuery as a dependency for an open source lib". sorry for misread

Re: You might not need jQuery

#125
I'm psyched by the idea that you don't need a bloated framework, but between using Zepto as an alternative, as well as the fact that some of this information is just plain wrong (e.g. they claim that the classList API is supported by IE8+, when in fact it is only supported by IE10+), this won't get you too far.

Re: You might not need jQuery

#126
post #44
post #21

You had me convinced until I scrolled down to read the code examples and realized why I actually do need jQuery. If its between adding yet another collection of utility functions to approximate the functionality jQuery would give me vs just adding jQuery. I'd rather go with jQuery.

The first example alone is reason enough to use jQuery - why would I want to use four statements instead one? Why would I want to have to remember to call `send`? Why do I have to remember the last boolean parameter of `open`?

Totally valid, but just to say, jQuery's API is just as arbitrary, you just happen to know it better. If you use the native XHR a couple times, you know what open's parameters are.

Re: You might not need jQuery

#127
post #40
post #26

"You might not need Ruby on Rails. Use C to rewrite tons of shit you need." Use jQuery please. Rewriting jQuery methods with vanilla js usually turns out to be a hack job that is buggy and ugly. Just use jQuery.

That's a really bad analogy. People don't use Ruby because C's standard library works differently across different platforms. This isn't about "rewriting jQuery methods with vanilla js". It's about using the built-in, native, vastly more performant methods that come standard on modern browsers.

The analogy is even worse because Ruby changes way faster than C :)

But anyway, writing code in any 'lower' layer is very educational.

Re: You might not need jQuery

#130
post #57

No, please no. If size is an issue for some reason or you want to have no dependencies you can use something like http://zeptojs.com/ and just embed everything in one minified file. If you do things right only the functions you are actually using will get placed in there as well. Do not reinvent the wheel to solve problems that can't be solved in much cleaner and nicer ways. Managing dependencies can be annoying, but…

Only supports IE 10+ D:
Post reply on HN