MooTools

{{Short description|Software}}

{{Multiple issues|

{{self-published|date=November 2008}}

{{primary sources|date=November 2008}}

}}

{{Infobox software

| name = MooTools

| logo = MooTools (logo).png

| caption = A screenshot of Class.js, MooTools' Class (computer science) implementation.

| developer = [http://mootools.net/developers The MooTools Dev Team]

| released = {{Start date and age|2006|9|8}}[https://web.archive.org/web/20061206015242/http://mad4milk.net/entry/mootools-released Original release announcement]

| latest release version = 1.6.0

| latest release date = {{Start date and age|2016|01|14}}{{Cite web|url=https://github.com/mootools/mootools-core/releases/tag/1.6.0|title=Release 1.6.0 · mootools/Mootools-core|website=GitHub}}

| genre = Ajax framework / JavaScript Framework

| programming language = JavaScript

| license = MIT License{{cite web|title=MooTools|url=https://mootools.net/|website=mootools.net}}

| repo = https://github.com/mootools/mootools-core

| website = {{URL|https://mootools.net}}

}}

MooTools (My Object-Oriented Tools){{Cite web |url=http://cpojer.net/Talks/MooToolsFOSDEM.pdf |title=MooTools at FOSDEM slides |access-date=2010-02-17 |archive-url=https://web.archive.org/web/20110723055127/http://cpojer.net/Talks/MooToolsFOSDEM.pdf |archive-date=2011-07-23 |url-status=dead }} is a lightweight, object-oriented JavaScript framework. It is released under the free, open-source MIT License.[http://mootools.net The Official MooTools Website]

Overview

MooTools provides the user with a number of options beyond native JavaScript. These include:

  • An extensible and modular framework allowing developers to choose their own customized combination of components.[http://mootools.net/core MooTools' Core Download Page]
  • MooTools follows object-oriented practices and the DRY principle.[http://docs.mootools.net/Class/Class MooTools Class Object] {{webarchive|url=https://web.archive.org/web/20080831105841/http://docs.mootools.net/Class/Class |date=2008-08-31 }}
  • An advanced effects component, with optimized transitions such as easing equations used by many Flash developers.[http://docs.mootools.net/Fx/Fx MooTools' Effects (FX) Class] {{webarchive|url=https://web.archive.org/web/20080623211248/http://docs.mootools.net/Fx/Fx |date=2008-06-23 }}
  • 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.[http://docs.mootools.net/Element/Element MooTools' Element Class - A comprehensive list of Element manipulation methods.] {{webarchive|url=https://web.archive.org/web/20080905200158/http://docs.mootools.net/Element/Element/ |date=2008-09-05 }}

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),[http://mootools.net/blog/2010/03/19/a-better-way-to-use-elements/ A Better Way to Use Elements] as well as a custom downloads module allowing developers to download only the modules and dependencies they need for a particular app.[http://mootools.net/core MooTools Core Builder][http://mootools.net/more MooTools More Builder]

History

Valerio Proietti first authored the framework and released it in September 2006{{cite book

| first1 = Aaron

| last1 = Newton

| title = MooTools Essentials: The Official MooTools Reference for JavaScript and Ajax Development

| publisher = Apress

| edition = 1st

| pages = xvi

| date = September 18, 2008

| isbn = 978-1-4302-0983-6

| url = http://apress.com/book/view/1430209836

}} taking as his inspiration Prototype and Dean Edward's [http://code.google.com/p/base2/ 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.{{cite book

| first1 = Aaron

| last1 = Newton

| title = MooTools Essentials: The Official MooTools Reference for JavaScript and Ajax Development

| publisher = Apress

| edition = 1st

| pages = xv

| date = September 18, 2008

| isbn = 978-1-4302-0983-6

| url = http://apress.com/book/view/1430209836

}} 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 extended—prototyped—many of JavaScript's native String, Array, and Function objects with additional methods, Proietti desired a framework that (at the time)Version 1.6.1 of Prototype includes "an element metadata storage system." [http://www.prototypejs.org/2009/9/1/prototype-1-6-1-released Prototype 1.6.1 released] {{webarchive|url=https://archive.today/20100301104944/http://www.prototypejs.org/2009/9/1/prototype-1-6-1-released |date=2010-03-01 }}

by Sam Stephenson, written September 1st, 2009. Retrieved March 21, 2010. further extended the native Element object as well to offer greater control of the Document Object Model (DOM).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. ({{cite book

| first1 = Aaron

| last1 = Newton

| title = MooTools Essentials: The Official MooTools Reference for JavaScript and Ajax Development

| publisher = Apress

| edition = 1st

| pages = xvi

| date = September 18, 2008

| isbn = 978-1-4302-0983-6

| url = http://apress.com/book/view/1430209836

}})

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.[http://mootools.net/docs/core MooTools Core] {{webarchive|url=https://web.archive.org/web/20091002162608/http://mootools.net/docs/core |date=2009-10-02 }}
  • More: An official collection of add-ons that extend the Core and provide enhanced functionality.[http://mootools.net/docs/more MooTools More] {{webarchive|url=https://web.archive.org/web/20091004112249/http://www.mootools.net/docs/more |date=2009-10-04 }}
  • Class: The base library for Class object instantiation.[http://docs.mootools.net/Class/Class#Class MooTools Class] {{webarchive|url=https://web.archive.org/web/20080831105841/http://docs.mootools.net/Class/Class |date=2008-08-31 }}
  • 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.[http://docs.mootools.net/Element/Element MooTools Element] {{webarchive|url=https://web.archive.org/web/20080905200158/http://docs.mootools.net/Element/Element/ |date=2008-09-05 }}
  • Fx: An advanced effects-API to animate page elements.[http://docs.mootools.net/Fx/Fx MooTools Fx Class] {{webarchive|url=https://web.archive.org/web/20080623211248/http://docs.mootools.net/Fx/Fx |date=2008-06-23 }}
  • Request: Includes XHR interface, Cookie, JSON, and HTML retrieval-specific tools for developers to exploit.[http://docs.mootools.net/Request/Request MooTools Request Class] {{webarchive|url=https://web.archive.org/web/20080730230537/http://docs.mootools.net/Request/Request |date=2008-07-30 }}
  • Window: Provides a cross-browser interface to client-specific information, such as the dimensions of the window.[http://docs.mootools.net/Element/Element.Dimensions#Element:getSize In addition to getting the size for any Element, you can easily get the dimensions of the window] {{webarchive|url=https://web.archive.org/web/20080911085358/http://docs.mootools.net/Element/Element.Dimensions |date=2008-09-11 }}

Browser compatibility

MooTools is compatible and tested with:[http://mootools.net/ MooTools lists its compatibility on its homepage.]

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 intuitively 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 containing either properties or methods (functions). Class is effortlessly mixed and extended with other Class instantiations allowing for the most excellent 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.[http://jqueryvsmootools.com/ jQuery versus Mootools]

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

{{Reflist|colwidth=30em}}

Further reading

  • [https://www.scientific.net/AMM.496-500.2328 "The Introduction to MooTools Architecture"]. Applied Mechanics and Materials.
  • [https://www.scientific.net/AMM.496-500.2042 "Interactive Consultation Based on MooTools Long Polling Techniques"]. Applied Mechanics and Materials.
  • {{cite book

| first1 = Leslie M.

| last1 = Orchard

| first2 = Ara

| last2 = Pehlivanian

| first3 = Scott

| last3 = Koon

| first4 = Harley

| last4 = Jones

| title = Professional JavaScript Frameworks: Prototype, YUI, ExtJS, Dojo and MooTools

| publisher = Wrox Press

| edition = 1st

| page = 888

| date = August 31, 2009

| isbn = 978-0-470-38459-6

| url = http://www.wrox.com/WileyCDA/WroxTitle/Professional-JavaScript-Frameworks-Prototype-YUI-ExtJS-Dojo-and-MooTools.productCd-047038459X.html

}}

  • {{cite book

| first1 = Aaron

| last1 = Newton

| title = MooTools Essentials: The Official MooTools Reference for JavaScript and Ajax Development

| publisher = Apress

| edition = 1st

| page = 300

| date = September 18, 2008

| isbn = 978-1-4302-0983-6

| url = http://apress.com/book/view/1430209836

}}

  • {{cite book

| first1 = Xavier

| last1 = Lecomte

| title = Découvrez MooTools : Un framework JavaScript pour un site dynamique et interactif (FR)

| publisher = DigitBooks

| edition = 1st

| page = 260

| date = June 1, 2012

| isbn = 978-2-8150-0215-8

| url = http://javascript.developpez.com/livres/index/?page=Frameworks#L2815030152

}}