4 ms·
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/jQue
by polemic 13y ago
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, but as you add more dynamic behaviour, at some point you'll wish you had just used it to begin with.
A better message might be: make sure you know what the underlying javascript looks like, because there are a lot of people helpless without jQuery.
PLUG: if you're bored of jQuery, try Dojo. Far more power, in a less intrusive form, IMO.
- fat0wl 13y agoi 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 initialization pattern.
- polemic 13y agoI 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.
- fat0wl 13y agoo 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
- danielweber 13y agoIsn'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.
- mcintyre1994 13y agoI 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.