The more I learned about JQuery, my admiration started to extend beyond a mere aesthetic appraisal and into the code quality itself. The design, the implementation, the rigorous testing, the obvious expertise of the JQuery creator (John Resig; I recommend you dig up a video or two of his presentations – you’ll be impressed), the compatibility with the Ruby style/ethos/philosophy. All of these things started to become important considerations.
The trouble is, JQuery and Prototype aren’t entirely compatible. And given that it’s inevitable that there will be a transition period in which both have to coexist in the application, you have to deal with that incompatibility.
There are two ways in which you’ll feel this as a Rails developer. For one, both Prototype and JQuery compete to define the
$() function in the global namespace. It seems that the simplest workaround here is just to let Prototype win and keep
$() for itself, and use JQuery’s
jQuery() function in the meantime until you can finally jettison Prototype from your application.
The other issue you’ll have to deal with is that fact that all Rails helpers and many plug-ins assume the presence of Prototype in the application and do their stuff using it. One of your options here is using jRails, which provides compatibility overrides of pretty much all (or even all?) of the Rails helper methods which use Prototype.
So in any case, I’ve started making the move from Prototype to JQuery.
Fourth step. Dump Prototype (and Scriptaculous).
Luckily, I hadn’t gone crazy with the AJAX stuff yet so there isn’t too much that’ll need to be changed. Pretty much nothing public-facing, all just back-end admin stuff.