Ok I solved it, I made myself a script which replaces all occurences of
$ with $ID, but leaves all other functions as they are.
I made the generated prototype.js available at
http://xhochy.org/en/2007/03/18/using-prototype-with-drupal-5/

Aaron workaround did not work, because it breaks Drupal (Part 1 of it),
because Drupal uses jQuery's $ directly, or it breaks Prototype(Part 2
of it), because when renaming the $()-function of Prototype just in
time, the code of Prototype is broken since prototype uses $() itself.

Hope this solves a problem for other Drupal+Prototype Developers too.

Greets
Uwe

Brandon Aaron schrieb:
> Actually jQuery is already prepared for easy alias renaming. If you
> are using a more recent version (jQuery 1.1+) you can use the
> jQuery.noConflict() method [1]. Otherwise, in older versions you can
> manually change it by adding this snippet of code:
>
> $ = jQuery._$;
>
> After doing that you can now use jQuery instead of $ to use jQuery
> methods. You can still safely use the jQuery plugins, since they
> should not be relying on the $ alias.
>
> If you would like to change the alias to something like $j, you could
> do the following.
>
> var $j = jQuery.noConflict()  // only on newer versions jQuery 1.1
>
> // older version of jQuery (jQuery 1.0.4 or less)
> $ = jQuery._$;
> $j = jQuery;
>
>
> However, I just checked Drupal's own JavaScript and they do rely on
> the $ alias. So, doing the above would break their code. Hopefully we
> can work with Drupal to remove the dependency on the $ alias and avoid
> this conflict in the future.
>
> Until then, you can use something like this to change the prototype alias.
>
> var $p = jQuery._$;
>
> Now you can use $p for your prototype scripts.
>
> Note: For the above to work, jQuery needs to be included after
> Prototype. Otherwise, if jQuery is included before prototype, then you
> will need to do something like this to avoid breaking Drupal's code.
>
> var $p = $;
> var $ = jQuery;
>
> Hope that helps!
>
> [1]: http://docs.jquery.com/Core#.24.noConflict.28.29
>
> --
> Brandon Aaron
>
> On 3/17/07, xhochy <[EMAIL PROTECTED]> wrote:
>   
>> At the moment we are migrating to Drupal and Drupal uses jQuery as
>> JSLib  which uses $() as a function too. Do you think I can build my
>> own Prototype.js that doesn't conflict with jQuery by replacing all
>> occurencs of $( with $ID( in prototype or is there some code that
>> could break?
>>
>> Greets
>> Uwe L. Korn
>>
>> PS: I'm not able to rename any functions in jQuery even it would be
>> simpler.
>>
>>
>>     
>
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Spinoffs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to [EMAIL PROTECTED]
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-spinoffs?hl=en
> -~----------~----~----~----~------~----~------~--~---
>
>
>   


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to