MooTools (My Object-Oriented Tools) is a lightweight,
object-oriented
Object-oriented programming (OOP) is a programming paradigm based on the concept of " objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of ...
JavaScript
JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
framework. It is released under the
free, open-source MIT License
The MIT License is a permissive free software license originating at the Massachusetts Institute of Technology (MIT) in the late 1980s. As a permissive license, it puts only very limited restriction on reuse and has, therefore, high license co ...
.
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.
* MooTools follows object-oriented practices and the
DRY
Dry or dryness most often refers to:
* Lack of rainfall, which may refer to
** Arid regions
** Drought
* Dry or dry area, relating to legal prohibition of selling, serving, or imbibing alcoholic beverages
* Dry humor, deadpan
* Dryness (medica ...
principle.
* An advanced effects component, with optimized transitions such as easing equations used by many Flash developers.
* 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.
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), as well as a custom downloads module allowing developers to download only the modules and dependencies they need for a particular app.
History
Valerio Proietti first authored the framework and released it in September 2006
taking as his inspiration
Prototype and Dean Edward'
base2 MooTools originated from Moo.fx, a popular
JavaScript
JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
effects library released in October 2005 by Valerio Proietti as an add-on to the
Prototype Javascript Framework
The Prototype JavaScript Framework is a JavaScript framework created by Sam Stephenson in February 2005 as part of Ajax support in Ruby on Rails. It is implemented as a single file of JavaScript code, usually named prototype.js. Prototype is d ...
. It can be used as a lighter alternative to
script.aculo.us
The Prototype JavaScript Framework is a JavaScript framework created by Sam Stephenson in February 2005 as part of Ajax support in Ruby on Rails. It is implemented as a single file of JavaScript code, usually named prototype.js. Prototype is dis ...
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) further extended the native Element object as well
to offer greater control of the
Document Object Model
The Document Object Model (DOM) is a cross-platform and language-independent interface that treats an XML or HTML document as a tree structure wherein each node is an object representing a part of the document. The DOM represents a docum ...
(DOM).
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.
* More: An official collection of add-ons that extend the Core and provide enhanced functionality.
* Class: The base library for Class object instantiation.
* Natives: A collection of
JavaScript
JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
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
An HTML element is a type of HTML (HyperText Markup Language) document component, one of several types of HTML nodes (there are also text nodes, comment nodes and others). The first used version of HTML was written by Tim Berners-Lee in 1993 ...
object.
* Fx: An advanced effects-API to animate page elements.
* Request: Includes
XHR
XMLHttpRequest (XHR) is an API in the form of an object whose methods transfer data between a web browser and a web server. The object is provided by the browser's JavaScript environment. Particularly, retrieval of data from XHR for the purpose o ...
interface, Cookie,
JSON
JSON (JavaScript Object Notation, pronounced ; also ) is an open standard file format and data interchange format that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and arrays (or other s ...
, and
HTML
The HyperText Markup Language or HTML is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets (CSS) and scripting languages such as JavaScri ...
retrieval-specific tools for developers to exploit.
* Window: Provides a cross-browser interface to client-specific information, such as the dimensions of the window.
Browser compatibility
MooTools is compatible and tested with:
*
Safari
A safari (; ) is an overland journey to observe wild animals, especially in eastern or southern Africa. The so-called "Big Five" game animals of Africa – lion, leopard, rhinoceros, elephant, and Cape buffalo – particularly form an importa ...
3+
*
Internet Explorer
Internet Explorer (formerly Microsoft Internet Explorer and Windows Internet Explorer, commonly abbreviated IE or MSIE) is a series of graphical user interface, graphical web browsers developed by Microsoft which was used in the Microsoft Wind ...
6+
*
Mozilla Firefox
Mozilla Firefox, or simply Firefox, is a free and open-source web browser developed by the Mozilla Foundation and its subsidiary, the Mozilla Corporation. It uses the Gecko rendering engine to display web pages, which implements current a ...
2+
*
Opera
Opera is a form of theatre in which music is a fundamental component and dramatic roles are taken by singers. Such a "work" (the literal translation of the Italian word "opera") is typically a collaboration between a composer and a libre ...
9+
*
Chrome
Chrome may refer to:
Materials
* Chrome plating, a process of surfacing with chromium
* Chrome alum, a chemical used in mordanting and photographic film
Computing
* Google Chrome, a web browser developed by Google
** ChromeOS, a Google Chrome- ...
4+
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.
jQuery versus Mootools
/ref>
Object-oriented programming
MooTools contains a robust Class creation and inheritance system that resembles most classically based Object-oriented programming language
Object-oriented programming (OOP) is a programming paradigm based on the concept of " objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of ...
s. For example, the following is MooTools' equivalent of the examples in Wikipedia's polymorphism page:
var Animal = new Class();
var Cat = new Class();
var Dog = new Class();
var animals = ;
Object.each(animals, function(animal) );
// alerts the following:
//
// Missy: Meow!
// Mr. Bojangles: Meow!
// Lassie: Arf! Arf!
See also
* Ajax framework
* Rich Internet application
A rich web application (originally called a rich Internet application, or RIA or installable Internet application) is a web application that has many of the characteristics of desktop application software. The concept is closely related to a sin ...
* Web 2.0
* Comparison of JavaScript frameworks
* XMLHttpRequest
* JavaScript framework
* JavaScript library
References
Further reading
"The Introduction to MooTools Architecture"
''Applied Mechanics and Materials''.
"Interactive Consultation Based on MooTools Long Polling Techniques"
''Applied Mechanics and Materials''.
*
*
*
External links
*
{{DEFAULTSORT:Mootools
JavaScript libraries
Ajax (programming)
Software using the MIT license
Web frameworks