views:

108

answers:

4

I am wondering if it is OK to use multiple javascript frameworks for example (jQuery, Raphael) in the same script (handling event & ajax with jQuery and drawing with Raphael) ?

+2  A: 

Yeah it's fine. jQuery will happily not bind to $ if you ask it (and need it):

jQuery.noConflict();
Oli
+2  A: 

I don't think there's any problem about it since Raphael's demo already uses jQuery : http://raphaeljs.com/analytics.html (look at code source).

Kaaviar
well, Raphael was just an example... ;)
Reigel
Ok so other answers seems better :)
Kaaviar
+2  A: 

If you have good reason to do so: yes. Such a reason would be that both frameworks have different features. Obviously you should only use stable frameworks that have no known issues of interference with other frameworks (or provide a way to avoid interference, like jQuery does with the noConflict method)...

Anyway it might not be a bad idea to search the jQuery plugin directory (plugins.jquery.com) to see if there's anything available like Raphael, or maybe a plugin that integrates Raphael with jQuery before combining the two yourself...

Koen
+5  A: 

Raphael isn't really a framework. It's a specialized library.

When it comes to mixing frameworks, then it is usually a bad idea.

While you can usually persuade them to run without conflicting, you end using a lot of code that does the same job as a lot of other code in the page. This adds a lot of overhead to the page, which is bad for performance.

David Dorward
+1, there's very little point in combining the big frameworks. It's a lot of extra work for little gain. If a framework is missing something you think it should have, create a plugin for it.
Andy E