MooTools is an open source, compact, and modular object-oriented programming JavaScript web application framework. The stated design goal of MooTools is to provide a means for developers to write cross-browser JavaScript in an elegant fashion, which is clearly seen in the many built-in functions for manipulation of CSS[1]. MooTools provides a documented API that is more object-oriented than the standard JavaScript implementation provided by web browsers.
Benefits
MooTools provides the user with many advantages over flat JavaScript. Among them:
- An extensible and modular framework, where the developer can choose which components to use.[2]
- MooTools follows object-oriented practices and the DRY principle, which makes the framework rich, powerful and efficient.[3]
- An advanced Effects component, with optimised Transitions such as Easing Equations used by many Flash developers.[4]
- Many enhancements to the DOM, enabling developers to easily navigate the document in code.[5]
Components
MooTools includes many components. Of note is the download builder application available on the mootools site that enables a user to download only the parts of the library they plan on using, and all necessary dependencies. In addition, users can choose the level of compression for the resulting download. Some of the component categories are outlined here:
- Core: a collection of utility functions that all the other components require.[6]
- Class is MooTools base library for Class object instantiation.[7]
- Natives: a collection of JavaScript Native Object enhancements. The Natives add functionality, compatibility and new methods that simplify coding.
- Element contains a slew of enhancements and compatibility to the HTML Element object.[8]
- Fx is an advanced effects API to animate Elements.[9]
- Request: provides XHR interface, Cookie, JSON, and HTML retrieval specific tools for developers to exploit.[10]
- Window: provides a cross-browser interface to the Client specific information, for instance window size[11].
Browser Compatibility
MooTools is compatible and tested with[12]:
Object-oriented programming
MooTools contains a robust Class creation and inheritance system that resembles most Object-oriented programming languages. For example, the following is a MooTools' equivalent of the examples in Wikipedia's polymorphism page:
var Animal = new Class({
initialize: function(name){
this.name = name;
}
});
var Cat = new Class({
Extends: Animal,
talk: function(){
return 'Meow!';
}
});
var Dog = new Class({
Extends: Animal,
talk: function(){
return 'Arf! Arf';
}
});
var Animals = {
a: new Cat('Missy'),
b: new Cat('Mr. Bojangles'),
c: new Dog('Lassie')
};
for(var animal in Animals) alert(animal.name + ': ' + animal.talk());
// alerts the following:
//
// Missy: Meow!
// Mr. Bojangles: Meow!
// Lassie: Arf! Arf!
Related
See also
References
External links
|