A few things:
- Namespace collision is not an issue. Prototype and Mootools would conflict, but you wouldn't be using those on the same page anyway. Prototype and jQuery can coexist in jQuery's special "no conflict" mode (in which jQuery uses a different function name and cedes the "$" to Prototype). But it's just not worth it to use more than one framework â€”Â there's nothing functionality-wise that you can get from one but not another.
- Rails includes view helpers for visual effects and Ajax stuff. These use Prototype/script.aculo.us out of the box. The "jRails plugin":http://ennerchi.com/projects/jrails changes these helpers to rely on jQuery instead. In addition, RJS is a light enough abstraction that it can work with any framework rather easily.
- Script.aculo.us relies on Prototype. You can't use Dojo and script.aculo.us together without also including Prototype â€” which is possible, but not advisable (see point #1). Dojo has its own effects engine that will do nicely.
- The best way to decide which framework to use is to spend a few hours with each one and figure out which makes the most sense in your head.
Disclosure: I am a co-maintainer of Prototype.
I went with jQuery as it did what I needed and I haven't found a place that jQuery didn't work. Honestly not super familiar with all of the other libraries but I say use what you know and what does the job you need.
Really we need someone that does ROR more than I to comment on the libraries and the integration with ROR.
Curtis, thanks for your response. Here's what I got so far, is it correct?
JQuery and Prototype seem to accomplish the same thing - DOM selection and adding on convenience methods for you to do things to your elements (replace the text within something, hide things, show things, etc). jQuery goes beyond prototype in that it has some visual affects, but they look more limited than scriptaculous (which makes sense as that's all scriptaculous seems to be about, and it comes packaged with prototype). Neither seems to have any widgets, although jQuery seems to have an offshoot library called jQueryUI which has. jQuery actually has a section on their site on how to use it with other libraries and avoid collisions - it looks fairly simple.
scriptaculous seems to be all about visual effects - hiding/showing things in fancy ways, highlighting things for brief periods, sliding things across the screen, etc. They do have some drag and drop features in the library as well, but it doesn't look like they really have any widgets either.
Dojo and YUI seem to combine the same aspects of jQuery or Prototype, as well as providing a widget library (date pickers, dropdowns, grids/tables, etc.) They also both have some animation, although I don't how much there is included in the library. Either could most likely be combined with something like scriptaculous if we wanted access to better animation, if neither has what we want. The animation in either library might be good on their own though.
Another thing to consider is that Prototype and scriptaculous come prepacked with Rails, and as such rails provides convenience methods on using these libraries. One could argue that the HELPERS are more of a crutch though, lots of argument about the helpers - pro and con.
After all this; leaning toward Dojo, combined with scriptaculous, if the effects are needed.
What do you think?
I have been talking to some good ROR devs and the answer I get is use what you know. ROR has Prototype and Scriptaculous included but I use jQuery included from the Google code library. I use it cause it's what I know. I believe that jQuery will become more tightly integrated in the future as ROR and MERB become more tightly integrated but honestly I kinda smile and nod when the hard core devs i know talk about MERB.