World Library  
Flag as Inappropriate
Email this Article
 

MooTools

MooTools
Developer(s) The MooTools Dev Team
Stable release 1.5.1 / August 29, 2014 (2014-08-29)[1]
Written in JavaScript
Type Ajax framework / JavaScript Framework
License MIT License
Website .netmootools

MooTools (My Object-Oriented Tools)[2] is a lightweight, object-oriented, JavaScript framework. It is released under the free, open-source MIT License.[3] It is used on more than 5% of all websites, and is one of the most popular JavaScript libraries.[4]

Contents

  • History 1
  • Components 2
  • Browser compatibility 3
  • Benefits 4
  • Emphasis on modularity and reusability 5
  • Object-oriented programming 6
  • See also 7
  • References 8
  • Further reading 9
  • External links 10

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 plug-in Proietti produced for Prototype in October 2005,[6] which is still maintained and used.

Whereas Prototype extended—prototyped—many 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:

  • Core: A collection of utility functions that all the other components require.[9]
  • More: An official collection of add-ons that extend the Core and provide enhanced functionality.[10]
  • Class: The base library for Class object instantiation.[11]
  • Natives: A collection of JavaScript Native Object enhancements. The Natives add functionality, compatibility, and new methods that simplify coding.
  • Element: Contains a large number of enhancements and compatibility standardization to the HTML Element object.[12]
  • Fx: An advanced effects-API to animate page elements.[13]
  • Request: Includes XHR interface, Cookie, JSON, and HTML retrieval-specific tools for developers to exploit.[14]
  • Window: Provides a cross-browser interface to client-specific information, such as the dimensions of the window.[15]

Browser compatibility

MooTools is compatible and tested with:[16]

Benefits

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

  • An extensible and modular framework allowing developers to choose their own customized combination of components.[17]
  • MooTools follows object-oriented practices and the DRY principle.[18]
  • An advanced effects component, with optimized transitions such as easing equations used by many Flash developers.[19]
  • Enhancements to the DOM, enabling developers to easily add, modify, select, and delete DOM elements. Storing and retrieving information with Element storage is also supported.[20]

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 WorldHeritage'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. ^ https://github.com/mootools/mootools-core/releases/tag/1.5.1
  2. ^ MooTools at FOSDEM slides
  3. ^ The Official MooTools Website
  4. ^ Usage of JavaScript libraries for websites
  5. ^ a b Newton, Aaron (September 18, 2008). MooTools Essentials: The Official MooTools Reference for JavaScript and Ajax Development (1st ed.).  
  6. ^ Newton, Aaron (September 18, 2008). MooTools Essentials: The Official MooTools Reference for JavaScript and Ajax Development (1st ed.).  
  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 Object—all JavaScript primitives like String and Function inherit from it—but 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.).  )
  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

  • Orchard, Leslie M.; Pehlivanian, Ara; Koon, Scott; Jones, Harley (August 31, 2009). Professional JavaScript Frameworks: Prototype,YUI, ExtJS, Dojo and MooTools (1st ed.).  
  • Newton, Aaron (September 18, 2008). MooTools Essentials: The Official MooTools Reference for JavaScript and Ajax Development (1st ed.).  
  • Lecomte, Xavier (June 1, 2012). Découvrez MooTools : Un framework JavaScript pour un site dynamique et interactif (FR) (1st ed.).  

External links

  • Official website
  • The Official MooTools User Group
  • Mootools Examples
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
 
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
 
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.
 


Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.