Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MooTools and JQuery Side by Side

I just inherited some web pages which uses MooTools. I never used MooTools. Now I need to add some functions on the page, I wonder if it's a good idea to use jquery and mooTools on the same page?

Basically, I have 3 options,

  1. Convert the pages to JQuery, which I have to learn MooTools to do that.
  2. Write new functions in MooTools. I have to learn even more MooTools to achieve this.
  3. Use both on the page.

Your opinion will be appreciated.

like image 246
ZZ Coder Avatar asked Oct 02 '09 15:10

ZZ Coder


3 Answers

Opinion: Learn MooTools and then move on with it. Sounds like a great opportunity to learn something new. Why introduce an entirely new library with addition js bloat if you don't need to. If it'll solve the problem you're golden.

like image 66
rball Avatar answered Oct 26 '22 23:10

rball


MooTools is a perfectly solid and acceptable Javascript library and I'd recommend you add it to your list of known technologies rather than tear it out and replace with JQuery. Mixing the two is not a good idea as you're likely to encounter obscure difficult to debug conflicts.

JQuery has had all the press of late, but it's by no means cut and dried that it beats every other library hands-down. Far from it. You might even find you prefer MooTools :-)

ADDED: For what it's worth my personal experience is that MooTools seems to play alongside other javascript code more nicely than jQuery. I've been handling several sites of late which have mixed in MooTools with various other pieces of Javascript for different effects/functionality and it's all seemed to play along together with minimal issues. OTOH pages that use jQuery tend to use jQuery versions of everything. YMMV of course.

like image 34
Cruachan Avatar answered Oct 27 '22 00:10

Cruachan


Personally, I'd recommend not using both, as there are strange conflicts, even with jQuery.noConflict(). Go with one or the other.

If you do end up using both, be sure to use jQuery.noConflict() to ensure that using the $ doesn't conflict.

Using jQuery with Other Libraries

like image 23
S Pangborn Avatar answered Oct 26 '22 23:10

S Pangborn