Question

I'm trying to optimise an application, written in Rails that depends quite a lot on "remote" links and forms (AJAX triggers). The thing is, that's pretty much all what we need jQuery for, so it seems like an overkill to use it. I was thinking is there a lighter approach to that, maybe replace/rewrite UJS to use some lighter javascript library (or none at all) and still get it working properly.

Was it helpful?

Solution

Since rails 3.0 ActionView helpers do not generate obtrusive inline javascript. All you need to know in order to make an ajax request is contained in the generated DOM. So feel free to create a ujs-driver for your prefered javascript library.

However, I personally would not do this. JQuery is not such a big overkill. And considering the fact that you can link it to your page from some CDN and the probability of the jquery having been previously cached in a user's browser very high, the benefits of getting rid of JQuery will be overwhelmed by the amount of time you'll spend developing/debugging/supporting your custom driver

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top