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.
You might not need jQuery
221–230 of 360 posts
Re: You might not need jQuery
#222Earlier quoted context omitted.
I believe the point is that many libraries use about 1% of jQuery. That hardly justifies pulling in the entire thing. A personal anecdote: I recently un-jQueried a little piece of code and ended up with only a couple lines of extra code. Certain parts of jQuery are heavenly and well worth it, but really basic usage doesn't actually save that much. $("#something") instead of document.getElementById("something") is not…
> I believe the point is that many libraries use about 1% of jQuery. That hardly justifies pulling in the entire thing. Sure, but if you use a few libraries that all use a couple features of jQuery you still only need to load jQuery one time and everything just works. You may not care if it only works on the most modern browsers, but someone who uses your library probably will.
Re: You might not need jQuery
#223Earlier quoted context omitted.
I believe the point is that many libraries use about 1% of jQuery. That hardly justifies pulling in the entire thing. A personal anecdote: I recently un-jQueried a little piece of code and ended up with only a couple lines of extra code. Certain parts of jQuery are heavenly and well worth it, but really basic usage doesn't actually save that much. $("#something") instead of document.getElementById("something") is not…
It might be the most cached file on the internet. Pulling jQuery is hardly expensive. Especially if you're pulling it from the google cdn.
Re: You might not need jQuery
#224No, 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…
I believe the point is that many libraries use about 1% of jQuery. That hardly justifies pulling in the entire thing. A personal anecdote: I recently un-jQueried a little piece of code and ended up with only a couple lines of extra code. Certain parts of jQuery are heavenly and well worth it, but really basic usage doesn't actually save that much. $("#something") instead of document.getElementById("something") is not…
Re: You might not need jQuery
#225I use jQuery because the DOM API for javascript sucks, and writing jQuery is fun. You're average web app perhaps doesn't need the latest Ruby/Python/PHP framework, or perhaps it you can write it without the framework. Or perhaps you can a compiled as opposed to interpreted language because that would be faster. OR maybe you can use something that is even faster, like perhaps Assembler! Fuck it write machine code if s…
How many lines of code are actually needed to give you selectors and the most common DOM manipulations?
How many lines of code are in jQuery?
Is there anything which would not be in selectors + common manipulations that you need, and which only jQuery can provide?
Re: You might not need jQuery
#226Re: You might not need jQuery
#227Earlier quoted context omitted.
Nope. jQuery 2 just removed code for IE 6/7/8. Nothing was added. Code sized reduced, but almost the same performance. My benchmark shows only 10-15% improvement. That's nothing compared to using the DOM API straight up.
Care to substantiate your benchmark where you compare jQ1, jQ2, and the native DOM API?
Here is his benchmark: http://jsperf.com/backbone-patch-22be8f9/2
It only compares jQuery 1 and the DOM API, no jQuery 2.
TestBaseView: DOM API
TestPaulView: Reduced jQuery usage
TestView: jQueryRe: You might not need jQuery
#228No, 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…
Having tools at your disposal is a good thing. Why would you type out four sentences when you can have pages of pre-written content?
Re: You might not need jQuery
#229Earlier quoted context omitted.
I believe the point is that many libraries use about 1% of jQuery. That hardly justifies pulling in the entire thing. A personal anecdote: I recently un-jQueried a little piece of code and ended up with only a couple lines of extra code. Certain parts of jQuery are heavenly and well worth it, but really basic usage doesn't actually save that much. $("#something") instead of document.getElementById("something") is not…
So why not break up a large library into smaller useful pieces. Why can't we import only what we need.