Contents
The dojo package is the foundation package of the Dojo Toolkit. It consists of three main areas:
Each of these areas are detailed in the following sections.
This file provides the bootstrap for loading other modules, in particular the require() function, previously known as dojo.require(). See the loader documentation for further details of how modules are loaded.
For backwards-compatibility, when dojo.js is included without the async: true configuration flag, all the modules in dojo/_base are implicitly loaded.
The dojo/_base directory contains modules with basic functionality, such as array operations. Typically, if a function or class exists within the dojo namespace directly (e.g. dojo.forEach()) then it is defined in dojo/_base.
However, note that the modules in dojo/_base are being phased out in favor of top level modules in the dojo/ directory. The dojo/_base files will be maintained until the 2.0 release. See details below for replacement modules.
dojoConfig (dojo/_base/config)
Possibility to override certain global settings that control how the framework operates
See Arrays and Dojo for details on dojo's array methods:
See also the NodeList array methods:
Function that generates a wrapper function that ensures a function that will only ever execute in a defined scope.
Function that generates a wrapper function that ensures a function will only ever execute globally.
Clones objects (including DOM nodes) and all children.
Returns a new object which "looks" to obj for properties which it does not have a value for.
Trim whitespace from a String
Simple templates with parameterized substitutions.
Mixes one object into another. Can be used as a shallow copy
Extends an object.
Get a property from a dot-separated string, such as A.B.C
Set a property from a dot-separated string, such as A.B.C
Determine if an object supports a given method
The following features are deprecated and will be removed in Dojo 2.0. See Testing Object Types for alternatives:
Checks if the parameter is a String
Checks if the parameter is an Array
Checks if the parameter is a Function
Checks if the parameter is an Object
Checks if the parameter is like an Array
Checks if the parameter is a built-in function
The dojo/_base/html module contains basic DOM & HTML handling functions for backward compatibility purposes.
New code should use the dojo/dom* modules instead.
This has been deprecated in lieu of dojo/Deferred, dojo/when and dojo/promise. New code should use these modules instead.
Communication between asynchronous calls
Allows a single code path for synchronous and asynchronous code execution.
Deferred objects also have a promise property that provides a read-only view of the result of the operation. This provides a safe robust object that can be passed to other functions without worry of the Deferred being mutated or improperly resolved against expectations.
From 1.7+ dojo/_base/kernel module contains the following parts of Dojo API:
Log a debug message to indicate that a behavior has been deprecated
Evaluate some string of JavaScript
An alias to the global scope.
A string containing the current locale as defined by Dojo.
Deprecated Returns a URL relative to a module. Use require.toUrl() instead.
The current version number of Dojo
from 1.7 + dojo/_base/window module collects following part of dojo APIs
Alias for the current document.
Return the body element of the document
Changes the behavior of many core Dojo functions that deal with namespace and DOM lookup
Call callback with globalObject as global and globalObject.document as dojo.doc
Call callback with documentObject as dojo.doc
The workhorse of most dojo/_base/fx animations. Used for animating CSS properties.
1.4+ previously dojo._Animation, the class behind all Dojo FX.
Shorthand version of animateProperty using positional arguments
Fades out a node.
Fades in a node.
This module provides event handling for DOM nodes, and AOP for functions. However, it is superseded by the dojo/on, dojo/aspect, and dojo/topic modules, which should be used for new code.
The methods defined in this module are:
Connects events to methods
Disconnects methods from linked topics
Linked a listener to a named topic
Remove a topic listener
Publish an event to all subscribers of a topic
Ensure that every time an event is called, a message is published on the topic.
Connects events to every node in the list, like dojo/_base/connect::connect().
Common event names mapped as functions on a NodeList - (e.g. .onclick(function(){}))
The dojo/_base/event module defines dojo DOM event API. See the dojo/_base/connect section above.
Functions related to document unloading
Call functions when the page unloads
Call functions when window.onunload fires
Signal fired by impending window destruction
1.4+ Pre-defined XHR content handlers, and an extension point to add your own custom handling.
Core for all xhr* verbs, eg: xhrPost, getGet
This module is defining deprecated symbols for loading. See the loader documentation for details on new replacement API's.
The AMD loader module.
Loads a JavaScript module from the appropriate URI
This has been moved deprecated in lieu of dojo/json.
dojo.declare (dojo/_base/declare)
Creates a constructor using a compact notation for inheritance and prototype extension
Color object and utility functions to handle colors. Defines the following API functions:
This module causes the browser-only base modules to be loaded.
A collection of key constants.
dojo._Url is used to manage the url object.
dojo/sniff is introduced in dojo 1.8 as the browser detection utility.
While using the legacy API, many of the modules listed here are auto-loaded and made available in the global scope for Legacy compatibility purposes, it is not advisable. The best practice is to require in only the modules you need to use within your application. For example, previously, if you need to retrieve a DOM node by its ID, you might have accomplished this by just accessing the dojo global scope object like:
var myNode = dojo.byId("myNode");
But to ensure the current best practices from Dojo 1.7 onwards, you should do the following:
require("dojo/dom", function(dom){
var myNode = dom.byId("myNode");
});
The following modules define the core DOM API for the Dojo Toolkit. For compatibility purposes, aliases to the Legacy API are defined in dojo/_base/html and dojo/_base/xhr modules. For new development it is recommended to require only the individual modules of the parts of the API that are needed and to reference them via their return variable. See each module for examples of what the common conventions are for doing this.
This module defines the core dojo DOM API. The convention for the return variable for this module is dom.
Select a DOM node by 'id'.
This module defines the core dojo DOM construction API. The convention for the return variable for this module is domConstruct.
This module defines the core Dojo DOM attributes API. This module will be retired in the future and superseded by dojo/dom-prop. The convention for the return variable for this module is domAttr.
Gets an attribute on an HTML element.
Sets an attribute on an HTML element.
Returns true if the requested attribute is specified on the given element, and false otherwise.
Removes an attribute from an HTML element.
Returns an effective value of a property or an attribute.
This module defines form-processing functions. The convention for the return variable for this module is domForm.
Serialize a form field to a JavaScript object.
Create an object from an form node
Serialize a form node to a JavaScript object.
Returns a URL-encoded string representing the form passed as either a node or string ID identifying the form to serialize.
This module defines the core dojo DOM style API. The convention for the return variable for this module is domStyle or style.
Return a cacheable object of all computed styles for a node
Accesses styles on a node.
Sets styles on a node.
This module defines the core Dojo DOM class API. The convention for the return variable for this module is domClass.
Returns a boolean depending on whether or not a node has a passed class string.
Adds a CSS class to a node.
Removes a class from a Node.
Toggles a className or an array of classNames.
Replaces one or more classes on a node if not present. Operates more quickly than calling dojo/dom-class::remove() and dojo/dom-class::add().
This module defines the core dojo DOM geometry API. The convention for the return variable for this module is domGeom.
Getter for the coordinates (relative to parent and absolute) of a DOM node. Deprecated in Dojo 1.4.
Getter for the border-box x/y coordinates and size of a DOM node.
Getter/setter for the margin-box of node
Getter/setter for the content-box of node
Get an object that encodes the width, height, left and top positions of the node's margin box.
Sets the size of the node's margin box and placement (left/top), irrespective of box model.
Get an object that encodes the width, height, left and top positions of the node's content box, irrespective of the current box model.
Sets the size of the node's contents, irrespective of margins, padding, or borders.
This module defines the core Dojo DOM properties API. The convention for the return variable for this module is domProp.
Takes a name/value mapping object and returns a string representing a URL-encoded version of that object.
Create an object representing a de-serialized query section of a URL. Query keys with multiple values are returned in an array.
Users who use D.O.H. plus Dojo get the added convenience of dojo.mouseMoveAt instead of computing the absolute coordinates of their elements themselves.
Loads an external app into an iframe and points dojo.doc to the iframe document, allowing the robot to control it.
Call functions after the DOM has finished loading and widgets declared in markup have been instantiated. When using AMD, in most situations the loader plugin dojo/domReady is preferable.
The main class for managing asynchronous threads.
The package that is the foundation for asynchronous thread management in Dojo.
The abstract base class that defines Dojo Promises.
Defines the default error that will be raised if a promise is cancelled without a reason.
Takes multiple promises and returns a new promise that is fulfilled when all promises have been fulfilled. Replaces dojo/DeferredList.
Takes multiple promises and returns a new promise that is fulfilled when the first of the promises have been fulfilled.
Trace promise fulfillment. Traced promises will emit events.
Provides transparent application of callbacks to promises or other arbitrary values.
The base module of the package that will return the default request provider based upon the current platform.
The plugin loader that returns the default provider.
The default provider for browser based platforms that provides a cross browser compatible XmlHttpRequest.
The default provider for node based platforms that provides an asynchronous node request.
The iframe provider, that uses a browser iframe to manage the communication.
The script provider that expects a <script> tag to embed the request payload.
Contains the payload handlers for requests and also provides the ability to register additional content handlers.
Publishes the dojo/request topics.
Provides the ability to watch inflight requests.
Allows for the mapping of providers by URI.
Deprecated - Sends an AJAX I/O call using an IFrame
Deprecated - Sends a JSONP request using a script tag
Communicate via Remote Procedure Calls (RPC) with Backend Servers
Generic JSONP service
JSON RPC service
RPC service class
The swiss army knife of DOM node manipulation in Dojo.
The different selector engines that are available in Dojo.
This module handles loading the appropriate selector engine for the given browser
dojo/selector/acme STUB
This is the default selector engine for Dojo.
dojo/selector/lite STUB
A small lightweight query selector engine that implements CSS2.1 selectors minus pseudo-classes and the sibling combinator, plus CSS3 attribute selectors.
Various modules that wrap DOM nodes and provide enhanced functionality and management.
A class to handle a list of DOM nodes. Most commonly returned from a dojo.query call.
Create classes out of each node in the list
Adds a .data() and .removeData() API to dojo.query operations
Adds dojo.fx animation support to dojo.query().
Adds a chainable html method to dojo.query()
1.4+ Method extensions to dojo.NodeList/dojo.query() that manipulate HTML.
1.4+ Method extensions to dojo.NodeList/dojo.query() for traversing the DOM.
Converts a JSON string into a JavaScript object
Converts a JavaScript object into a JSON string
Dojo Store is an uniform interface for the access and manipulation of stored data that will eventually replace dojo/data
A data access interface for in memory storage
A data access interface for a RESTful service providing JSON data
A wrapper for data stores that are observable
A wrapper for data stores that are cacheable
The deprecated uniform data access layer
A mechanism to cache inline text. This has been deprecated in 1.7 in lieu of the dojo/text AMD loader plugin.
Date manipulation utilities
dojo.date.locale
Offers a library of localization methods to format and parse dates and times
dojo.date.locale.addCustomFormats
Adds a reference to a bundle containing localized custom formats to be used by date/time formatting and parsing routines.
Formats a Date object as a String, using locale-specific settings or custom patterns.
Used to get localized strings from dojo.cldr for day or month names.
Determines if the date falls on a weekend, according to local custom.
Converts a properly formatted string to a primitive Date object, using locale-specific settings.
Builds the regular needed to parse a localized date
Drag and Drop
There are several modules that are plugins for the AMD Loader system. Consult the Loader documentation for more information on AMD Loader Plugins.
Defers execution of the module's factory function until the DOM is ready.
Loads text resources; it is a superset of RequireJS's text plugin, and subsumes dojo.cache.
Loads i18n bundles either in legacy or AMD format. It includes the legacy i18n API and is a superset of RequireJS's i18n plugin.
Allows has.js expressions to be used to conditionally load modules.
A convenience plugin for loading dependencies computed at runtime.
Downloads a legacy module without loading it. This allows the legacy code path to be guaranteed.
Causes dojo.loadInit callbacks then other legacy API functions to be executed--in particular those that are associated with a module.
A registry to make contextual calling/searching easier
Utility for unobtrusive/progressive event binding, DOM traversal, and manipulation
Get and set named properties in conjunction with the ability to monitor these properties for changes
Provides aspect oriented programming facilities to attach additional functionality to existing methods
A Common Locale Data Repository (CLDR) implementation
CSS color manipulation functions
Simple HTTP cookie manipulation
Localized formatting and parsing routines for currency data
Deprecated Event handling for a group of Deferred objects. Use dojo/promise/all instead.
Effects library on top of Base animations
Google Gears
Inserting contents in HTML nodes
Utility classes to enable loading of resources for internationalization
Localized formatting and parsing methods for number data
The DOM/Widget parsing package
Regular expressions and Builder resources
String utilities for Dojo
Provides extension events for hovering and mouse button utility functions
Provides normalized event listening and event dispatching functionality
Provides standardized touch events
Loads a Dojo module, by name