Reputation: 50752
jQuery is preferred a lot these days and one of the reasons or plus point is that it is said to be a very lightweight library. My question is what exactly makes it a lightweigt library? Is it the way the code is written OR is it the event handling mechanism OR has it something to do with the DOM?
Also to add, the performance of any web app which uses jQuery is much better compared to one with normal Javascript (e.g. smoother animation effects).
Upvotes: 4
Views: 3774
Reputation:
It can mean several different things. Some mentioned by others.
But I would like to add the simplicity
.
You can make use of a JQuery function with extremely little code overhead
, just include the js file and you are ready to use it in one line. As opposite to have a lot of config files special initialize and so on.
Upvotes: 1
Reputation: 149
Well it is light in the fact that it is quite performant, but being lightweight obviously depends on what you are comparing it to.
Plenty of developers would argue that it isn't compared to implementing certain behavior in just Javascript.
Upvotes: 0
Reputation: 27770
Size is one thing - jQuery 1.6.2 clocks in at around 31KB - but more importantly, jQuery is very low-level, meaning it doesn't try to do more than most of us need. UI features (which many developers don't need) are moved to a separate plugin, as are templates, advanced animations and effects, etc.
This helps to keep the framework itself very lean and useful to the widest possible group of developers.
Upvotes: 4
Reputation: 72965
The filesize is small when gzipped, and particular pains have been taken to ensure that it's as small as possible (avoiding use of eval when parsing JSON for instance).
It also concentrates on only having useful features, so it doesn't include things like a lightbox plugin or a way to create tabs, it just offers basic building blocks to build complex things.
Upvotes: 7