To resolve a conflict between jQuery and prototype,
is there any way other than asking jQuery to resolve via开发者_如何学CjQuery.noConflict
and using jQuery instead of $('code').code;
Can't we ask prototype $ to step down and resolve.
You should namespace your code anyway, and jQuery gives you a good opportunity to re-claim the $ in the same step:
jQuery.noConflict();
jQuery(function ($) {
// $ is the jQuery object in here
// and doesn't conflict with Prototype
});
As described here.
I don't know if you can make Prototype "step down", but this is a perfectly elegant and working solution.
PrototypeJS adds a bit more to the global JavaScript namespace than jQuery does. For example, it adds meanings for: Ajax, $, $$, $F, Abstract, Form, $A, $H, $R, $w. You can look at a complete list of classes and utilities at api.prototypejs.org.
So the advice you've gotten is correct, There's no simple equivalent to jQuery.noConflict() for PrototypeJS.
I can't find any function in http://api.prototypejs.org/ that will give back the $, like noConflict() in jQuery.
I wonder, what feature that you need so you still using prototype? jQuery might have plugins for that feature. Using 2 libraries in same page will make your page bloated by the size of each library.
加载中,请稍侯......
精彩评论