MooTools

MooTools
Developer(s) The MooTools Dev Team
Initial release March 7, 2007 (2007-03-07)[1]
Stable release
1.6.0 / January 14, 2016 (2016-01-14)[2]
Written in JavaScript
Type Ajax framework / JavaScript Framework
License MIT License
Website mootools.net

MooTools (My Object-Oriented Tools)[3] is a lightweight, object-oriented JavaScript framework. It is released under the free, open-source MIT License.[4]

History

Valerio Proietti first authored the framework and released it in September 2006[5] taking as his inspiration Prototype and Dean Edward's base2. MooTools originated from Moo.fx, a popular JavaScript effects library released in October 2005 by Valerio Proietti as an add-on to the Prototype Javascript Framework.[6] which is still maintained and used. It can be used as a lighter alternative to script.aculo.us or other, bigger libraries. It provides simple, basic effects, and guarantees a small library size.

Whereas Prototype extendedprototypedmany of JavaScript's native String, Array, and Function objects with additional methods, Proietti desired a framework that (at the time)[7] further extended the native Element object as well[5] to offer greater control of the Document Object Model (DOM).[8]

Components

MooTools includes a number of components, but not all need to be loaded for each application. Some of the component categories are:

Browser compatibility

MooTools is compatible and tested with:[16]

Benefits

MooTools provides the user with a number of advantages over native JavaScript. These include:

The framework includes built-in functions for manipulation of CSS, DOM elements, native JavaScript objects, Ajax requests, DOM effects, and more. MooTools also provides a detailed, coherent application programming interface (API)[21] as well as a custom downloads module allowing developers to download only the modules and dependencies they need for a particular app.[22][23]

Emphasis on modularity and reusability

Every JavaScript framework has its philosophy, and MooTools is interested in taking full advantage of the flexibility and power of JavaScript in a way that emphasizes greater modularity and code reuse. MooTools accomplishes these goals in a way that is intuitive to a developer coming from a class-based inheritance language like Java with the MooTools Class object.

Class is an object of key/value pairs that can contain either properties or methods (functions). Class is effortlessly mixed and extended with other Class instantiations allowing for the greatest focus of MooTools: Code reuse achieved through maximizing the power of JavaScript's prototypical inheritance, but in a Class object syntax more familiar to classical inheritance models.[24]

Object-oriented programming

MooTools contains a robust Class creation and inheritance system that resembles most classically based Object-oriented programming languages. For example, the following is 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')
};

Object.each(animals, function(animal) {
    alert(animal.name + ': ' + animal.talk());
});
 
// alerts the following:
//
// Missy: Meow!
// Mr. Bojangles: Meow!
// Lassie: Arf! Arf!

See also

References

  1. Earliest known release
  2. https://github.com/mootools/mootools-core/releases/tag/1.6.0
  3. MooTools at FOSDEM slides
  4. The Official MooTools Website
  5. 1 2 Newton, Aaron (September 18, 2008). MooTools Essentials: The Official MooTools Reference for JavaScript and Ajax Development (1st ed.). Apress. pp. xvi. ISBN 1-4302-0983-6.
  6. Newton, Aaron (September 18, 2008). MooTools Essentials: The Official MooTools Reference for JavaScript and Ajax Development (1st ed.). Apress. pp. xv. ISBN 1-4302-0983-6.
  7. Version 1.6.1 of Prototype includes "an element metadata storage system." Prototype 1.6.1 released by Sam Stephenson, written September 1st, 2009. Retrieved March 21, 2010.
  8. Note that MooTools does not extend the native Objectall JavaScript primitives like String and Function inherit from itbut instead provides a convenient Hash for the purpose: Think of it like having a set of utility methods that allow for nearly effortless object manipulation of regular JavaScript objects that are otherwise unaffected by the process. (Newton, Aaron (September 18, 2008). MooTools Essentials: The Official MooTools Reference for JavaScript and Ajax Development (1st ed.). Apress. pp. xvi. ISBN 1-4302-0983-6.)
  9. MooTools Core
  10. MooTools More
  11. MooTools Class
  12. MooTools Element
  13. MooTools Fx Class
  14. MooTools Request Class
  15. In addition to getting the size for any Element, you can easily get the dimensions of the window
  16. MooTools lists its compatibility on its homepage.
  17. MooTools' Core Download Page
  18. MooTools Class Object
  19. MooTools' Effects (FX) Class
  20. MooTools' Element Class - A comprehensive list of Element manipulation methods.
  21. ,A Better Way to Use Elements
  22. MooTools Core Builder
  23. MooTools More Builder
  24. jQuery versus Mootools

Further reading

This article is issued from Wikipedia - version of the 9/15/2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.