The list I’m referring to is that of fantastic JavaScript frameworks. My list now includes Prototype (and the fact that I didn’t need to look up the URL just shows how many times I’ve recommended Prototoype), Dojo Toolkit, script.aculo.us and now MooTools.
I’ve not had the time to play around with MooTools yet, but simply looking at the help page you can’t deny that it looks sweet.
“OK” you may say to yourself, “it doesn’t look like there is anything too new in there”. Well even if it were just the really nice syntax changes, such as when extending classes:
var Mammal = Animal.extend({
initialize: function(){
...
}
});
Which is a lot more intuitive and concise than the current method offered in Prototype:
var Mammal = Class.create();
Object.extend(Object.extend(Mammal.prototype, Animal.prototype), {
initialize: function(){
...
}
});
I’d be happy to recommend MooTools on those improvements alone, intuitive and concise is always the best combination when it comes to programming languages as far as I’m concerned, but there is much more:
- OO inheritance, allowing you to call methods on the parent object when extending objects.
- Using the $ function to extend elements with the Element methods.
- Defining custom methods on elements.
- Powerful yet simple effects.
- The full release (when the compressed option is chosen) is around 20kb, consider that the latest version of Prototype alone is 53kb and when compressed (with the fabulous Dojo Rhino compressor) is still 36kb. To work around the large size of Prorotype & script.aculo.us combined I’ve had to break Prototype up into its component parts and then use a custom manager for managing script requirements (I plan to post about this in future once I’ve worked up a couple of examples); I mean who uses all the functionality Prototype offers at the same time?
Another of the potentially great things about the MooTools library is the FX themselves, I’m aware that Moo.fx has been around for a while, but the really great thing about Moo and is that it doesn’t seem to try and do all the work for you. If you’ve ever taken a look at using the script.aculo.us dragables or sortables for anything that slightly differs from the test cases or examples you’ll soon come a bit of a cropper, Johnathan Snook gives a good example of the simplicity and flexibility of the MooTools way of doing things in his post exploring drag and drop with MooTools.
I’m sure I’ll have more to post about MooTools in the near future as I’m planning to use it as my primary JavaScript framework for my next large project, so we’ll see if it lives up to expectations. For now I’ll just share a few links that I’ve found informative so far: