Live data from Hacker News

You might not need jQuery

youmightnotneedjquery.com

351–360 of 360 posts

Re: You might not need jQuery

#351

Earlier quoted context omitted.

except "many of the frameworks that exist for it hide or transform enough of the "native" implementation details as to be different languages. Or supersets of it" is wrong. It's all still javascript. Just.. plain.. javascript. with a different api/library.

I don't think you understood what I wrote. And I'll leave it at that.

is there an alternative interpretation? you appear to be saying that a library can make javascript into a new or superset language.

Are you saying something different?

Re: You might not need jQuery

#352
post #346

Earlier quoted context omitted.

The evidence is in the form of an experiment repeatable from your browser's dev console. Play with it.

If you hand me some code to run, I'll run it. Otherwise my test risks not being the same one that you used to make the claim. The onus is on the person making the claim, not the person trying to verify it.

Isn't the code to run here[1]?

[1]: http://jsperf.com/backbone-patch-22be8f9/2

Re: You might not need jQuery

#353
post #49

This be right on a purist level, but on every practical level there is little reason not to use [library of your choice]. If you're loading from the google/jQuery CDN (with suitable fallback, obvs.) you've got a good chance of a cache hit, and even if it misses it's a tiny one-off penalty. And ultimately, why not? jQuery works, has a wide base of users, etc. Sure your trivial Js might not need jQuery features now, bu…

Isn't it a giant security hole to be loading part of your library from another site you don't control? Zillions of people do it anyway, so it's not like you won't have lots of company.

I trust Google more than most websites small enough not to have their own CDN, it's probably much easier and more likely to compromise them than Google's CDN even if of course Google is a more attractive attack surface. I guess theoretically it is, but practically I doubt it's anywhere near the most practical attack vector.

Re: You might not need jQuery

#354
post #266

Earlier quoted context omitted.

> As a side note, I know this is totally a matter of taste but "chainable" in the JQuery sense reads to me as "spaghetti generator". I think this is more important than a side note. The reason jQuery's 'children' or 'find' is way better in my eyes is because of the support for arrays as target and argument, and the possibility to pass the resulting collection to the next command as is. Going the native route, filteri…

I don't think Array.prototype.forEach.call(el.querySelectorAll(selector)) is complex enough to pull in a new library.

It's not, but then you fall on IE9+ land, and you'll have to check if querySelectorAll returns anything first.

The sibling comment points out how a function silently failing when given empty value can be deceiptive. I guess your way of seeing it would be also in line with checking valid values before using them.

It's a very sane approach, and it requires more care and attention for each step. I'm not against it, but usually I'm not sure to see a real payoff for very conservative programming in front end DOM manipulation, I tend to prefer taking some performance hit and ignore the nitty gritty details as well as the small errors, as long as it can be recovered at a higher level.

Re: You might not need jQuery

#355
post #307
post #209

Earlier quoted context omitted.

Considering XMLHttpRequest is what other browsers used before IE caught up, I assume it does work the way you'd expect across modern browsers. I'd have to check the standard and IE8+'s conformance to the standard to be sure. That's what this post is really about for me, reminding that modern browsers follow a standard that allows for getting rid of most of jQuery. Reading it also made me recall a post from 2005 by PH…

XMLHttpRequest was first introduced in IE5. I think in retrospect MS regrets its introduction, but that is another discussion entirely.

I wouldn't mind hearing a snippet of that discussion. Why would MS regret XMLHttpRequest?

Re: You might not need jQuery

#356
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…

What would be awesome is if jQuery had the same kind of download builder as jQuery UI, so that you could only include the parts of it that you actually need for a library.

jQuery has support for custom builds. You can drop loads of stuff you'll probably never use if you wish!

I usually drop animations and the event shortcut functions. These seem pretty junky to me anyway.

Re: You might not need jQuery

#357
post #307

Earlier quoted context omitted.

XMLHttpRequest was first introduced in IE5. I think in retrospect MS regrets its introduction, but that is another discussion entirely.

I wouldn't mind hearing a snippet of that discussion. Why would MS regret XMLHttpRequest?

Microsoft twiddled its thumbs while the web grew up and around Windows using the technology the company introduced.

Re: You might not need jQuery

#358
post #346

Earlier quoted context omitted.

If you hand me some code to run, I'll run it. Otherwise my test risks not being the same one that you used to make the claim. The onus is on the person making the claim, not the person trying to verify it.

Isn't the code to run here[1]? [1]: http://jsperf.com/backbone-patch-22be8f9/2

See my previous comment[0]. That perf test is testing Backbone's use of jQ vs. native DOM, not jQ v. DOM in isolation. I don't trust that there aren't side effects and interactions in the test.

[0]: https://news.ycombinator.com/item?id=7155710

Re: You might not need jQuery

#359
post #357

Earlier quoted context omitted.

I wouldn't mind hearing a snippet of that discussion. Why would MS regret XMLHttpRequest?

Microsoft twiddled its thumbs while the web grew up and around Windows using the technology the company introduced.

That makes complete sense. Never thought of it that way.

Re: You might not need jQuery

#360
Sure, why use something stable that everybody knows and loves to use, while you can just add in your custom half-baked solutions.

In a post IE8 world adding a minified jQuery library is not a big deal.

Post reply on HN