I’d been hearing about jQuery for quite a whiles now but resisted the temptation to dive in. The Rails community in particular is quite abuzz with it and I’d heard the creator of it interviewed on Geoffrey Grosenbach’s Ruby on Rails Podcast.
Still I resisted, surely prototype and scriptaculous were the way to go, after all they’ve been shipping with Rails since forever and Rail’s has many functions that tightly integrate with them, especially its RJS view support.
Then I started to hear people becoming quite critical of RJS, in particular raising concerns over its abstraction of javascript and invasive approach to the DOM.
I continued on my merry way, working on my pet project, pulling out a lot of RJS support that I had previously but still using it where it made sense.
Then I started looking into potentially introduce an Accordion User Interface widget and thats when the wheels started to fall off for the prototype and scriptaculous cart that I was pushing.
I found an accordion extension for p & s and started playing around with it. It seemed to work fine on the demo site, but it looked horrible when I integrated it into mine. I discovered that it was built against prototype 1.5 whereas I was using 1.6.
It was at this point that that I decided that I’ve got myself a problem. jQuery had an accordion widget, I’d seen it demonstrated at a recent workshop at the WebDirections South conference in September and it looked pretty good. Time to bite the bullet.
I checked out Ryan Bate’s Railscast on jQuery to get a quick overview and see how to get it up and running quickly in Rails. Then I spent an hour checking out the jQuery website and getting familiar with the examples and API. All looking very impressive. Pretty quickly the concepts started to come through. It really struck me that the selector approach is incredible powerful and it made striving for unobtrusive Javascript easy, just like CSS is unobtrusive presentation.
Within a couple of hours my Rails app was devoid of all RJS, prototype and scriptaculous. jQuery was introduced and all my obtrusive Javascript removed!
Now it feels like I have a world of options available to spruce up my user interface too! The plugin repository is incredibly large, something which p & s are sorely missing.
The amount of inertia behind jQuery is quite impressive and in my opinion this is what counts. The fact that Rails developers are openly advocating it spells the end for prototype & scriptaculous too. Alas, they were great libraries but its time to move on, the mob has spoken.