@Jeff_MottJul 17.2011 — #[url=http://developer.yahoo.com/yui/]YUI[/url] is a good library. I actually like it better than jQuery.
Some reasons why:
[b]Dynamic loading[/b]
Some libraries need to load everything but the kitchen sink up front, but YUI lets you load only the pieces you need to use. It can also combine those dependencies into a single HTTP request while still allowing parallel downloads. This is huge for performance.
[code=php] // Create a new YUI instance and populate it with the required modules. YUI().use('anim', function (Y) {
// Animation is available and ready for use.
}) [/code]
[b]Earlier DOM events[/b]
Code that uses the DOM usually needs to wait for the DOM ready event before it can run safely, but YUI provides "available" and "contentready" events that let you execute as soon as an element is detected in the DOM, even if the DOM ready event hasn't fired yet.
[code=php] YUI().use('event', function (Y) { Y.on('contentready', function () {
// #myelementid is ready
}, '#myelementid'); }) [/code]
[b]Custom events[/b]
I was once building a jQuery widget, and to initialize it, I needed to 1) manipulate the DOM, and 2) download XML with ajax. So it was a question of which to do first. If I waited for the DOM ready event to manipulate the DOM, and only then started downloading the XML, then the whole application was delayed. And if I waited for the XML to download before manipulating the DOM, then I got a flash of unstyled content.
But with YUI's custom events, you don't need to put one before the other. You can do both in parallel and trigger events when each part is finished. This made the application responsive noticeably quicker.
// when both tasks have finished... Y.on('myapp:xmlready', function () { Y.on('myapp:domready', function () {
// app is ready to use
}); }); }); [/code]
[b]Ready-made widgets[/b]
Both YUI 2 and YUI 3 have an impressive set of ready-made widgets. All the usuals are there, like [url=http://developer.yahoo.com/yui/examples/autocomplete/ac_basic_array.html]AutoComplete[/url], [url=http://developer.yahoo.com/yui/examples/calendar/quickstart.html]Calendar[/url], [url=http://developer.yahoo.com/yui/examples/carousel/csl_selection.html]Carousel[/url], [url=http://developer.yahoo.com/yui/examples/container/panel.html]Panel[/url], [url=http://developer.yahoo.com/yui/examples/tabview/frommarkup.html]Tabs[/url], etc. Plus some that I thought were especially impressive, like [url=http://developer.yahoo.com/yui/examples/charts/charts-seriescustomization.html]Charts[/url], [url=http://developer.yahoo.com/yui/examples/datatable/dt_complex.html]DataTable[/url], and [url=http://developer.yahoo.com/yui/examples/uploader/uploader-advanced-queue.html/]Uploader[/url]. In addition to a [url=http://yuilibrary.com/gallery/popular]gallery[/url] of user contributed modules.
@rnd_meJul 19.2011 — #moo, jQuery, and yui are all the same thing, more or less.
i can't believe people still bother with dojo; it's useless on mobile...
JSON2.JS is my favorite library; it's used everywhere.
personally, i use a functional foundation for almost all my code. i guess the smallest one that people have heard of that doesn't totally suck is underscore, though you really just need it for old IE these days, what with [].map (finally) being in all current browsers...
if you want functional goodness and candy-coder tools, Prototype gives you the high-level ajax and dom stuff as the first ones i mentioned. It got a bad rap for being ambitious years ago, but it plays nicely now.
i guess if someone put a gun to my head and forced me to include one of those kitchen-sink type libs, i would pick prototype.
modernizer is handy if you don't know much about robust javascript and late-breaking browser developments...
more interesting to me are harmless scalpel libs that add specific functionality like charting, drag and drop, canvas tools, x-browser audio handling, etc.