Closed (fixed)
Project:
Drupal core
Version:
5.0-beta2
Component:
javascript
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
1 Dec 2006 at 17:20 UTC
Updated:
10 Mar 2009 at 09:08 UTC
I'm having some issues utilizing Prototype in combination with the new jQuery library.
It seems that no matter what I try when utilizing the drupal_add_js() I can not set prototype's priority to load before jQuery
Since I like utilizing the Drupal way of doing things, I need a way to elevate prototype.
See jQuery's page for an explanation of why this is required.
Comments
Comment #1
xhochy commentedI've made a custom version of Prototype 1.5.0 where the $()-function is renamed to $ID(), so that there is no conflict anymore with jQuery. You just need to change all invocations of $() in your scripts to $ID. This has already solved the problems with Lightbox2 and jQuery.
You can download it here:
Using Prototype with Drupal 5
Then you do not need to have prototype.js included before jQuery, because changing the $()-Function to prototype's would break drupal.js which need jQuery's $().
Comment #2
Steven commentedThere is a better way around this: enclose all core JS in a closure that uses passes in 'jQuery' as '$'. That way there is no conflict with the dollar sign operator of prototype.
Comment #3
xhochy commentedThis is fixed in the issue http://drupal.org/node/125030 where all internal $() calls are replaced with jQuery() and see http://drupal.org/node/224333#javascript_compatibility for the usage of jQuery code which still utilizes $() from jQuery.