I had some compatibility issues with jquery and mootools and I found an easy way to get rid of most of those problems.

As far as mootools and other javascript frameworks I know do not have a compatibility mode and jquery does, I started to rewrite some of the drupal core js srcipts to work in no-conflict mode.

It's not much work, only some minor changes here and there.

My site http://www.human-aspects.com runs a number of mootools scripts for menus, slideshows, PNG-fixes for IE6 and it does not conflict with jquery, so I guess this should really work in most cases.

I'd like to suggest to rewrite all jquery-dependent javascripts in drupal core to no-conflict mode, because it is possible to avoid conflicting javascript frameworks and I'd love to encourage other module contributors to write new scripts in the non-conflicting mode, just to open up drupal to other js frameworks as well.

So the most easiest way seems to submit patches for the affected js files, am I right?
(As far as I didn't contribute any modules to drupal by now, it would be nice to have some guidiance.)

Any idea how to effectively handle all those other jquery scripts in the modules is very welcome ...

Comments

_mark’s picture

i found that this is the best option .. worked for me. basically hiding your JQuery div id container from other libraries and using subsitute for '$(foo)' (like 'JQuery(foo)' in your scripts. Very easy and straightforward.

http://docs.jquery.com/Using_jQuery_with_Other_Libraries

marcingy’s picture

Status: Active » Fixed

Jquery suppports a non conflict mode.

marcingy’s picture

Status: Fixed » Closed (fixed)
eMPee584’s picture

Version: 5.x-dev » 7.x-dev
Priority: Normal » Critical
Status: Closed (fixed) » Fixed

Jquery suppports a non conflict mode.

unfortunately, the OP has been misunderstood and this has not been fixed for Drupal 6. It's a pity getting D6 JS to coexist with other JS frameworks is a major PITA.. there's the jquery_compatibility_mode module, but it depends on the drupal_override_function module which

REQUIRES that PECL APD >= 0.2 be installed before it will function.

so it will not be usable on the vast majority of shared hosts. The easiest way of solving this seems to be a dirty hack - replacing all occurrences of $( in the included framework and adapting the scripts that use it..
Fortunately, D7 has anonymous functions wrapping the jquery code, so rejoice - it's fixed!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

devyd’s picture

(eMPee's suggestion leaves you with a very elaborate setup of pre-1.0 PHP extensions)

Another way to achieve "jquery no-conflict mode (for core .js)" (avoiding core modifications) is using the JQuery Update Module by jjeff. It replaces all core .js files with updated jQuery .js files.

(Add var JJJ = jQuery.noConflict(); as the first line in all the .js files in sites\all\modules\jquery_update\replace.
Then do a global Search&Replace for all occurences of $( and replace it by $JJJ()

Voilà! no-conflict core jQuery.