This content was originally published at Kyan’s blog at http://kyan.com/blog/2010/4/7/jquery-s-conquest-of-the-web, but is no longer available at that location. Reproduced here with permission.

jQuery’s conquest of the web

We love Ruby on Rails at Kyan: it removes a lot of the complexity in setting up a web app leaving us free to build the stuff that actually matters. Take a front end development perspective though and things start to look a little … messy. Rails’ inbuilt helpers let you get client-side interaction up and running quickly, but at the cost of blocks of fairly impenetrable code that rely on the Prototype Javascript framework. Even if you don’t use the helpers, Prototype is still part of the default Rails install.

Around about the time we started concentrating more on hand-coded Javascript, we decided that coding in Prototype wasn’t for us and migrated over to jQuery instead. This is not to denigrate Prototype – it provided a very solid base for Rails with good browser compatibility – but jQuery has a much more compact syntax and a better plugin community. One way to migrate is just to remove the default Prototype links and include jQuery, but to keep the transition smooth we also used a project called jRails: a Rails plugin that rewrites the inbuilt helpers to export the jQuery syntax.

For a year or two this setup gave us the flexibility to happily hand-code our own front-end Javascript and take advantage of jQuery’s plugin ecosystem, at the expense of having to ignore various Rails plugins that expected Prototype to be available. More recently though we’ve seen signs that the rest of the Rails community might be following our move. Plugins started appearing with dual Prototype/jQuery helpers (the Textile editor we use for text entry for example). Now even entire Rails applications are dropping Prototype in favour of jQuery. We’re currently evaluating the Spree e-commerce platform which has standardised on jQuery over Prototype.

The news seems to have reached the core Rails developers: as of Rails 3 the framework is officially agnostic towards Javascript frameworks. The expected JS development methodology is now unobtrusive hooking, which is far better in terms of code re-use and lower complexity. Outside of Rails jQuery’s prospects are looking even better. Microsoft are now directly contributing code to jQuery, and ship it with Visual Studio. Some stats sites are even claiming a near 30% usage rate among top-10,000 sites which is pretty extraordinary.

Overall, we’re very happy with the choice we made. Congratulations to the jQuery team, and here’s the the next couple of years of progress!