Hi All, I know that jQuery.noConflict() is used to avoid conflict between $ of any other library and jQuery.(i.e. Prototype) But lets say, by any chance I am using Prototype, MooTools and jQuery.In that case jQuery.noConflict() will work fine for jQuery and any other library combination, but then what with Prototype and MooTools, if they both use $, how come code /browser will identify it properly. Note:I have never worked with Prototype and MooTools , so I am sorry if my question doesn't make any sense.
+1
A:
If these other frameworks don't have something corresponding to the noConflict
option, the last loaded of these frameworks will overwrite the definition of $
with their own, and the first loaded framework will be broken, if they both depend on $
David Hedlund
2009-11-24 14:22:29
Thanks, for the info.
Wondering
2009-11-24 15:17:02
You could study how jQuery implements noConflict and apply it to the the moo sources and contribute it back to the community. Ditto for prototype.
Jeff Paquette
2009-11-24 16:07:11
that's an excellent suggestion flyfishr64 =)
David Hedlund
2009-11-24 22:51:54
A:
Normally mixing two libraries is strongly discouraged. Not only due to potential conflicts, but due to the excessive overhead and performance implications. Mixing three would obviously be even worse.
The best solution to this problem is to take one or more frameworks out of the equation. Anything you can do in jQuery can be accomplished in Mootools and vice versa. Anything written on Prototype can be ported to jQuery or Mootools fairly trivially as well.
jmking
2009-12-16 23:26:44