Should I use prototype.js or jQuery for a new project? Rails comes with prototype.js but jQuery seems the library of choice for the rest of the world. Is prototype.js still under active development? It seems a little bit dusty ...
The reasons I use jQuery over any other library:
Fast and Lightweight
jQuery continues to increase the performance of their library even in of minor-revision-level releases. When they released 1.4.2, the speed of the library was greatly increased even from 1.4.1, as shown in an Ajaxian blog post regarding its release. Performance analysis of 1.4 compared to 1.3 was done by the jQuery team in the release announcement for 1.4, showing that 1.4 had been heavily optimized in the areas of its most frequent use and that performance had also increased across the board.
jQuery is served by 48 of the top 2000 websites in the Alexa directory, compared to Prototype's 6, MooTools's 3, and Dojo's 1.
Actively (and Intelligently) Developed
In March, jQuery posted on its blog Microsoft to Expand its Collaboration with the jQuery Community. From the post:
Microsoft is now included in the community of active contributors to the jQuery codebase. Microsoft has some very smart developers. Microsoft also financially contributes to jQuery. Microsoft has a lot of money. They are also giving jQuery instant exposure to any developer with Visual Studio. Microsoft is also working on ASP.NET to specifically make jQuery's integration better:
Also learn how ASP.NET AJAX was designed to work seamlessly with jQuery, how you can create ASP.NET AJAX controls directly from jQuery and how you can use the jQuery library in ASP.NET AJAX code.
More on Microsoft's use of jQuery can be found in Scott Guthrie's ASP.NET blog post jQuery and Microsoft.
jQuery's source code is hosted publicly on GitHub. This is a plus for me personally since I prefer Git to other SCM systems.
jQuery's Sizzle selector engine is great. And it's great because jQuery isn't working on it alone. In a blog post announcing the release of v1.3 early last year, they basically said "We know we're not smarter than everybody else and we're more interested in advancing the community by working with smart people than in saying we're better than they are."
Additionally, as a sign of good faith and willingness to collaborate, we've released the source code to Sizzle to the Dojo Foundation. We wanted a common meeting ground where everyone would be able to work together and under which there would be a clear long-term copyright holder.
Right now we're working with Prototype, Dojo, Yahoo UI, MochiKit, and TinyMCE (and many others) on Sizzle, honing it to perfection.
In the YayQuery podcast, Episode 18 (mp3), John Resign outlines the plans for jQuery's mobile support. The philosophy is that the primary jQuery library should be compatible with mobile devices, instead of writing a dedicated mobile version. One of the many benefits of this is that as your primary library is used on general as well as mobile websites, it is more likely to become cached, and mobile-specific websites can use the same cached version as non-mobile websites. John also explains exactly which phones and operating systems are planned for support.
jQuery can be used with PhoneGap to create native applications using web technologies for mobile devices. It also has a plugin named JQTouch for building native-like web apps for the iPhone and other mobile browsers. This means all those shortcuts you have with jQuery translate to other platforms, decreasing the learning curve.
Active in the Development Community
It's really a matter of preference. I tend towards jQuery, personally. It's well documented, has lots of good plugins, and makes my life a whole lot easier. I've heard some complaints from the Prototype people about its size and performance (sorry, I don't remember their specific problem) but both of those aspects have been getting better and better.
I would try both out and see which one is a better fit for you.
It is a matter of preference obviously. I have found jquery is a little but more difficult to understand for newbies since the chaining is not really intuitive in particular when asynchronous race conditions occur. However, jquery certainly has more plugins but that can also be a disadvantage when too many plugins are automatically loaded.
While on the surface it's based on your preference, consider looking at the libraries, plugins, and samples of things that you want to use jQuery or Prototype to accomplish. For example, with a new Rails project all AJAX is done using prototype by default. Also if you want to use jQuery UI or jQTouch (mobile) I would recommend jQuery.