Okay, so here it comes again... (I hope not) Recently I've started using Prototype and jQuery together -- I use all the Prototype extension methods and the jQuery "$". jQuery documentation offers several solutions for working alongside of Prototype. However, there does not seem to be a way to have a root- level $ for jQuery while still having Prototype work as expected (if $ is jQuery $ then Prototype features are prone to stop working).
While the jQuery solutions do work in some cases, they did not offer an easy GLOBAL solution. The amount of existing code in my case that uses jQuery (and my desire to keep $ as jQuery $ -- no suggestions about replacing jQuery entirely or using $j, please) reveal the real issue -- the sharing of $. Thus leads me to my solution: I have modified prototype.js such that function $ is renamed to $P and $$ is renamed to $P and all *internal* Prototype references are to $P or $$P. Then I have setup aliases from $ to $P and $$ to $$P. Then <script src="prototype.js" ... <script src="jquery.js" ... allows the use of $ for jQuery (with NO ADDITIONAL MODIFICATIONS) while allowing the rich prototype decorating of Prototype. This allows the use of both Prototype and jQuery seamlessly. The owner of $ is then controlled entirely by load order. Perhaps you wanted $ to be Prototype "$" in your code but still have jQuery, then: <script src="jquery.js" ... <script src="prototype.js" ... Now jQuery is still loaded correct, $ is Prototype $. And the jQuery- suggested jQuery/Prototype interoperability suggestions may be used. Anyway, all this typing to present the case of a trivial modification to prototype.js so that it is more interoperable with jQuery (and potentially other uses of $) and I humbly ask that the idea is considered. I am new to Prototype but I can see not reason for a negative impact of this solution. The names I chose, $P and $$P were arbitrary and could easily be more descriptive. If third-party libraries that used Prototype also followed suit (using $P/$$P) then they should also be immune to jQuery (or other) overloading of $. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~----------~----~----~----~------~----~------~--~---