If you can get along with everyone and everyone loves you, then you don’t stand for much. A person who stands his ground for his principles and won’t compromise his integrity is not loved by everyone. — Larry Winget

jQuery or MooTools in WordPress?

jquery vs mootoolsI have recently ditched the MooTools Javascript library in favour of the jQuery Javascript library. What that means is I have removed the MooTabs and SmoothGallery from this web site and replaced them with jQuery scripts instead.

My reasons for giving up MooTools…

  1. WordPress uses the jQuery Javascript library in the admin pages. In fact, you will find the jQuery files in the “wp-includes/js/jquery” directory.
  2. WordPress has built-in support for the jQuery library. The wp enqueue script function has a list of supported jQuery libraries and widgets but none for MooTools.
  3. Some of my favourite WordPress plugins like the NextGen gallery use jQuery so I have to load the jQuery library on my web site.
  4. I didn’t want to have 2 different Javascript libraries on my web site because it would increase the loading time of my pages.
  5. I found better and simpler jQuery scripts to replace MooTabs and SmoothGallery on my web site.

Since jQuery is so well integrated into the WordPress platform, I don’t wish to reinvent the wheel and use MooTools on top of jQuery.

I found this blog post by Figo explaining the differences between jQuery and MooTools:

MooTools is aimed more at JavaScript developers, while jQuery is more for people who want to implement JavaScript functionality in the easiest possible way.

jQuery is for people who aren’t necessarily interested in delving deep into JavaScript while MooTools provides an object-oriented framework for hardcore JavaScript development. This is why most people find MooTools harder to use in comparison to jQuery.

As a web developer, I personally find jQuery a lot easier to work with than MooTools. It really makes coding in Javascript and creating cool effects a lot easier. jQuery suits my needs better than MooTools because I only use it to create some special effects on web sites and I have no desire or need to learn very advanced Javascript.

Another personal reason for using jQuery is I can create Flash-like effects without using Flash, which is expensive to create because of the expensive software required. For examples on how jQuery is beating the pants off Flash, check out Lam’s great post, How jQuery is Killing Flash.

On the jQueryVsMooTools.com web site, the author points out about the fundamental differences between jQuery and MooTools:

jQuery’s description of itself talks about HTML, events, animations, Ajax, and web development. MooTools talks about object oriented-ness and writing powerful and flexible code. jQuery aspires to “change the way you write JavaScript” while MooTools is designed for the intermediate to advanced JavaScript developer.

Part of this consideration is the notion of a framework vs a toolkit. MooTools is a framework that attempts to implement JavaScript as it should be (according to MooTools’ authors). The aim is to implement an API that feels like JavaScript and enhances everything; not just the DOM. jQuery is a toolkit that gives you an easy to use collection of methods in a self-contained system designed to make the DOM itself more pleasant. It just so happens that the DOM is where most people focus their effort when writing JavaScript, so in many cases, jQuery is all you need.

At the end of the day, it isn’t a matter of which one is better or worse but which one of the 2 Javascript library suits your needs and Javascript coding level.

Similar Posts

Facebook Comments

Post a Comment


(Required)


(Required)