drye
drye

Reputation: 1402

What JavaScript frameworks conflict with each other?

There are times when I want to use mootools for certain things and Prototype & script.aculo.us for others but within the same site. I've even considered adding others, but was concerned about conflicts. Anyone have experience, or am I just trying to make things too complicated for myself?

Upvotes: 5

Views: 1684

Answers (7)

Mats Bryntse
Mats Bryntse

Reputation: 564

My Framework Scanner tool is useful for finding JS/CSS conflicts between libraries:

http://mankz.com/code/GlobalCheck.htm

Upvotes: 0

Sergey Ilinsky
Sergey Ilinsky

Reputation: 31535

A recent question: jQuery & Prototype Conflict

Prototype.js library used to be very offensive and conflicted with many other libraries / code. However, to my knowledge, they recently given up with some really hard-core staff, such as replacing Element object etc.

Upvotes: 1

Sergey Ilinsky
Sergey Ilinsky

Reputation: 31535

From my experience I can say that some javascript libraries rather conflict with the browser, than with each other. What I mean is the following: sometime code written against some library will not well co-exist with the code written against browser DOM.

Upvotes: 0

Ris Adams
Ris Adams

Reputation: 1355

My suggestion is to learn one (or more!) framework(s) very well so that you will be able to replicate the features you need without adding the overhead of multiple frameworks.

remember the more code that you push to the client the slower everything becomes.

Upvotes: 0

ConroyP
ConroyP

Reputation: 41916

If you really, really want to do this, then you will be able to without too many problems - the main libraries are designed to behave well inside their own namespaces, with a couple of notable exceptions - from Using JQuery with Other Frameworks:

The jQuery library, and virtually all of its plugins are constrained within the jQuery namespace. As a general rule, "global" objects are stored inside the jQuery namespace as well, so you shouldn't get a clash between jQuery and any other library (like Prototype, MooTools, or YUI).

That said, there is one caveat: By default, jQuery uses "$" as a shortcut for "jQuery", which you can over-ride.

So, yes, you can do it, but you'd likely be creating maintenance headaches further down the line for yourself - subtle differences between framework functions may be obvious to you today, but come back in 6 months and it can be a whole other story! So I would recommend keeping it as simple as you can, and having as few different frameworks (preferrably 1!) as you can in your codebase.

Upvotes: 7

Joeri Sebrechts
Joeri Sebrechts

Reputation: 11146

AFAIK, all the popular frameworks are designed to be combined with other frameworks. I don't think combining them is that much of a problem. I would however discourage combining them purely from a case of bandwidth needs. A slow site experience is less forgivable than a more complicated development experience.

Upvotes: 3

Ken
Ken

Reputation: 2092

You are better off sticking with a single framework per application. Otherwise your client will spend too much time/bandwidth downloading the javascripts.

That being said, Prototype and JQuery can work together. Information is on the JQuery web site.

Upvotes: 0

Related Questions