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

xhochy’s picture

I'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 $().

Steven’s picture

There 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.

xhochy’s picture

Status: Active » Closed (fixed)

This 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.