Apr 09 2008

MooTools Overrides $, $$ Makes MooTools ‘Not Suck’ So Bad

Months ago, we started to redesign different parts of our sites and started using Ajax to accomplish that. Some of my co-workers liked using MooTools and I am a jQuery user. Just so I could get things done at work and not try and learn a new javascript framework, I wrote my code in jQuery. When one of my co-workers asked why I was using it, I explained the pros and very few cons of jQuery. Work now conforms to a jQuery standard and makes my life a lot easier.

However, while redesigning GradCity.com (still not live yet as of post date), we found a MooTools version of a feature we wanted to add into the site. We thought about how we could convert it into jQuery, but we didn’t want to spend too much time on that and get behind on the rest of the site. We decided to leave it in there for now until we presented the new design to management. However, it was conflicting with jQuery like we knew it would. We spent time changing the few items that we currently had in there from jQuery’s $(“#something”).click(…) to jQuery(“#something”).click(…) for now so everything would work. However, most of the jQuery plugins use $ and the plugins themselves are packed. I wanted to find a way that I could redefine the namespace for the one MooTools plugin and use the $ for jQuery.

Now, we still don’t have time to convert yet, but I think I found an easier way of making this happen. I make a post to the MooTools forum and got two different answers. However, the one answer that I like tells me that I can use $$ and it will leave the $ namespace alone for jQuery to play with. The $$ is the annoying new kid who no one likes and everyone starts making fun of him instead of the scrawny little kid who can’t play basketball. Now people can get along with the scrawny kid because he is not the oddball anymore.

jQuery is 1000% better than MooTools in my opinion.

About the author

Timothy Haroutunian

Timothy Haroutunian is a ServiceNow Cloud Implementation Specialist at Acorio. ServiceNow is an IT Management solution that allows for a complete view of your IT and physical environment.

Permanent link to this article: http://www.armenianeagle.com/2008/04/09/mootools-overrides-makes-mootools-not-suck-so-bad/


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.