Alexey Petrushin
2011-Jul-17 22:59 UTC
Re: Rails JS best practices? (jQuery + Prototype / MooTools
So, does anyone use PrototypeJS with jQuery? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Jim Ruther Nill
2011-Jul-18 03:37 UTC
Re: Re: Rails JS best practices? (jQuery + Prototype / MooTools
On Mon, Jul 18, 2011 at 6:59 AM, Alexey Petrushin <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:> So, does anyone use PrototypeJS with jQuery? > >I''ve used prototype with jquery before. Now, I only use jquery since it''s supported out of the box by rails3 (with ajax helpers working using the jquery-rails gem). I remember that you just have to add a single line to make prototype working with jquery. var $j = jQuery.noConflict(); then remember to use $j instead of $ when you want to use jquery functions.> -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- ------------------------------------------------------------- visit my blog at http://jimlabs.heroku.com -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Walter Lee Davis
2011-Jul-18 20:04 UTC
Re: Re: Rails JS best practices? (jQuery + Prototype / MooTools
It''s generally not a good idea to use two large libraries like this in the same page. Not only do they conflict (unless you use the jQuery.noConflict() patch to rewrite any uses of the $ function defined in Prototype) but they each do more or less the same thing, so it''s a waste to force a download of both on your users. It''s been my experience that anything you want to do in jQuery you can do in Prototype, and vice-versa. Walter On Jul 17, 2011, at 6:59 PM, Alexey Petrushin wrote:> So, does anyone use PrototypeJS with jQuery? > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google > Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails- > talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > . > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en > . >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
CoffeScript is standard from Rails 3.1 so it will be the best practice for sure. http://jashkenas.github.com/coffee-script/ Give it a try, bests: gezope On Jul 18, 12:59 am, Alexey Petrushin <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> So, does anyone use PrototypeJS with jQuery? > > -- > Posted viahttp://www.ruby-forum.com/.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Peter De Berdt
2011-Jul-19 15:56 UTC
Re: Re: Rails JS best practices? (jQuery + Prototype / MooTools
Coffeescript has nothing to do with Javascript libraries like jQuery or Prototype. It''s a precompiler for Javascript, i.e. it converts Coffeescript code to Javascript. Yes, we use Prototype and jQuery together. You just need to put jQuery into compatibility mode and then use jQuery("blahblah") for jQuery code and the usual $ for Prototype. Be on the lookout for badly written jQuery plugins though (the ones that don''t scope their code). On 19 Jul 2011, at 17:15, gezope wrote:> CoffeScript is standard from Rails 3.1 so it will be the best practice > for sure. > http://jashkenas.github.com/coffee-script/ > Give it a try, bests: > gezope > > On Jul 18, 12:59 am, Alexey Petrushin <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> So, does anyone use PrototypeJS with jQuery? >Best regards Peter De Berdt -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.