Navigating the Dojo API Tool

There are several different methods of navigating through the object structure of the Dojo Toolkit:

  • Use the namespace list (to the left). The simplest method would be to use the list of namespaces defined by the Dojo Toolkit, on the left side of every page.
  • Drill-down from where you are. The API Tool was designed to give you as much information via drill-down as possible. Everything defined in an object can be clicked on, for more information.
  • Use the search. At the top of the namespace list to the left is a search box; type in the terms you are looking for, and you will be taken to a result page that spans the entire toolkit.
Move to different sections

In addition, objects with large numbers of contained types have a simple way of jumping to sections on a page; simply look at the right side of any heading, and you will see a set of quick navigation icons. Clicking a type icon will take you to that section; clicking the up arrow icon will return you to the top of the page.

Inherited and private members

Show or hide variable types

The Dojo API Tool will show the full ancestry of an object's members (including how that member was defined and whether or not it overrides an original). By default, all members of an object that are inherited are shown with the object's API listing, and all private members are hidden.

To toggle either inherited or private members, look just beneath the breadcrumb bar (above the name of the object you are viewing) and click the appropriate link.

Switching styles

Choose a style

The Dojo API Tool was designed with several themes in mind; we know that some people prefer light on dark, while others might prefer dark on light. With this in mind, two themes (Noir and Blanc) are currently available, with more on the way.

To switch visual styles, click on the theme you want to use, near the top right corner of the page. The API Tool will remember which style you prefer and automatically load that theme on subsequent visits.

Key/Legend

Namespace Namespaces
A namespace in Dojo parlance is an object/property bag that can contain almost anything: constructors, methods, properties, etc. Usually is expressly defined to serve a particular purpose; for example, dojo.date.locale is a namespace defined to deal with locale-specific date handling.
Constructor Constructors
A constructor is a function designed to create instances of objects. With the Dojo Toolkit, there are two ways of creating constructors: the "old school" way (i.e. defining a function with the this keyword in the body) or using dojo.declare.
Singleton Singletons
A singleton is a constructor that is defined and then immediately executed so that only one instance may ever exist during an application's lifetime. Usually this is done to capture some information in the environment, or to ensure a set of private variables that cannot be accessed from outside of the declaration. Examples include dojox.encoding.crypto.Blowfish.

Data Types

Array Array
Arrays are ordered lists, native to Javascript.
Boolean Boolean
Native data type representing a simple "true/false" value.
Date Date
Native Javascript data type to handle common date and time representations.
DOMNode Node
An object that represents any kind of element being referenced/used by Javascript code. Note that the type of element is not dictated by this data type; only that it is a node of some sort.
Error Error
A special, native Javascript object used to indicate an error in code. Can be subclassed and used in conjunction with the throw statement, i.e. throw new MySubError(...);
Function Function
Functions/methods are pieces of invocable code; in JavaScript, they are also considered data and can be passed around like any other object.
Number Number
A Number object is used to represent any kind of numeric value; note that Javascript does not guarentee the actual underlying datatype (though the most common is a 64-bit float).
Object Object
Objects are the base data type of Javascript. With the Dojo API Tool, a type that cannot be determined is usually marked with this icon, in addition to straight objects.
Regular Expression RegExp (Regular Expression)
A regular expression is an object used for fast string search and parsing.
String String
A string is any sequence of characters.

Input formats

  • Filtered HTML:
    • Web page addresses and e-mail addresses turn into links automatically.
    • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>

      This site allows HTML content. While learning all of HTML may feel intimidating, learning how to use a very small number of the most basic HTML "tags" is very easy.

      For more information see W3C's HTML Specifications or use your favorite search engine to find other sites that explain HTML.

      Most unusual characters can be directly entered without any problems.

      If you do encounter problems, try using HTML character entities. A common example looks like &amp; for an ampersand & character. For a full list of entities see HTML's entities page.

    • Lines and paragraphs are automatically recognized. The <br /> line break, <p> paragraph and </p> close paragraph tags are inserted automatically. If paragraphs are not recognized simply add a couple blank lines.
  • PHP code:
    • Using custom PHP code

      If you know how to script in PHP, Drupal gives you the power to embed any script you like. It will be executed when the page is viewed and dynamically embedded into the page. This gives you amazing flexibility and power, but of course with that comes danger and insecurity if you do not write good code. If you are not familiar with PHP, SQL or with the site engine, avoid experimenting with PHP because you can corrupt your database or render your site insecure or even unusable! If you do not plan to do fancy stuff with your content then you are probably better off with straight HTML.

      Remember that the code within each PHP item must be valid PHP code - including things like correctly terminating statements with a semicolon. It is highly recommended that you develop your code separately using a simple test script on top of a test database before migrating to your production environment.

      Notes:

      • You can use global variables, such as configuration parameters, within the scope of your PHP code but remember that global variables which have been given values in your code will retain these values in the engine afterwards.
      • register_globals is now set to off by default. If you need form information you need to get it from the "superglobals" $_POST, $_GET, etc.
      • You can either use the print or return statement to output the actual content for your item.

      A basic example:

      You want to have a box with the title "Welcome" that you use to greet your visitors. The content for this box could be created by going:

      print t("Welcome visitor, ... welcome message goes here ...");
      								

      If we are however dealing with a registered user, we can customize the message by using:

      global $user;
      if ($user->uid) {
      	print t("Welcome $user->name, ... welcome message goes here ...");
      }
      else {
      	print t("Welcome visitor, ... welcome message goes here ...");
      }
      								

      For more in-depth examples, we recommend that you check the existing Drupal code and use it as a starting point, especially for sidebar boxes.

  • Full HTML:
    • Web page addresses and e-mail addresses turn into links automatically.
    • Lines and paragraphs are automatically recognized. The <br /> line break, <p> paragraph and </p> close paragraph tags are inserted automatically. If paragraphs are not recognized simply add a couple blank lines.
  • Markdown:
    • Quick Tips:
      • Two or more spaces at a line's end = Line break
      • Double returns = Paragraph
      • *Single asterisks* or _single underscores_ = Emphasis
      • **Double** or __double__ = Strong
      • This is [a link](http://the.link.com "The optional title text")
      For complete details on the Markdown syntax, see the Markdown documentation.
  Login Register Help
API Documentation
Choose a stylesheet:

Namespacedojo

Jump to PropertiesJump to FunctionsJump to ConstructorsNamespacesBack to top

Browser history management resources
transformation of relevant pieces of the Unicode.org Common Locale Data Repository (see http://unicode.org/cldr) to JSON from the original XML with associated utility classes
Color utilities
localized formatting and parsing routines for currencies
A uniform data access layer
Date manipulation utilities
Drag and Drop resources
Effects library on top of Base animations
Utility classes to enable loading of resources for internationalization (i18n)
Additional I/O transports (Ajax)
localized formatting and parsing routines for Number
The Dom/Widget parsing package
Regular expressions and Builder resources
Dojo remote-procedure-call resources
String utilities for Dojo

Jump to PropertiesJump to FunctionsJump to NamespacesConstructorsBack to top

Constructordojo.AdapterRegistry(returnWrappers: Boolean?)
A registry to make contextual calling/searching easier.
Returns an animation that will transition the properties of node defined in ‘args’ depending how they are defined in ‘args.properties’
takes a named string, hex string, array of rgb or rgba values, an object with r, g, b, and a properties, or another dojo.Color object
Constructordojo.Deferred(canceller: Function?)
Encapsulates a sequence of callbacks in response to a value that may not yet be available. This is modeled after the Deferred class from Twisted <http://twistedmatrix.com>.
Constructordojo.DeferredList(list: Array, fireOnOneCallback: Boolean?, fireOnOneErrback: Boolean?, consumeErrors: Boolean?, canceller: Function?)
Provides event handling for a group of Deferred objects.
signal fired when initial environment and package loading is complete. You may use dojo.addOnLoad() or dojo.connect() to this method in order to handle initialization tasks that require the environment to be initialized. In a browser host, declarative widgets will be constructed when this function finishes runing.
dojo.NodeList is as subclass of Array which adds syntactic sugar for chaining, common iteration operations, animation, and node manipulation. NodeLists are most often returned as the result of dojo.query() calls.
Constructordojo._Line(start: Integer, end: Integer)
dojo._Line is the object used to generate values from a start value to an end value
Constructor to create an object representing a URL. It is marked as private, since we might consider removing or simplifying it.
Internal xd loader function. Clears the interval timer used to check on the status of in-flight xd module resource requests.
Internal xd loader function. Resets the xd state.
Internal xd loader function. Monitors in-flight requests for xd module resources.
Constructordojo.__FadeArgs(node: DOMNode|String, duration: Integer?, easing: Function?)
Constructordojo.__IoCallbackArgs(args: Object, xhr, url: String, query: String, handleAs: String, id: String, canDelete: Boolean, json: Object)
In addition to the properties listed for the dojo._IoArgs type, the following properties are allowed for dojo.xhr* methods.

Jump to PropertiesJump to ConstructorsJump to NamespacesFunctionsBack to top

Functiondojo.addClass(node: DomNode|String, classStr: String)
Adds the specified classes to the end of the class list on the passed node.
Registers a function to be triggered after the DOM has finished loading and widgets declared in markup have been instantiated. Images and CSS files may or may not have finished downloading when the specified function is called. (Note that widgets’ CSS and HTML code is guaranteed to be downloaded before said widgets are instantiated.)
registers a function to be triggered when the page unloads
Functiondojo.anim(node: DOMNode|String, properties: Object, duration: Integer?, easing: Function?, onEnd: Function?, delay: Integer?)
a simpler interface to dojo.animateProperty(), also returns an instance of dojo._Animation but begins the animation immediately unlike nearly every other Dojo animation API.
Functiondojo.attr(node: DomNode|String, name: String|Object, value: String?)
Gets or sets an attribute on an HTML element.
Functiondojo.blendColors(start: dojo.Color, end: dojo.Color, weight: Number, obj: dojo.Color?)
blend colors end and start with weight from 0 to 1, 0.5 being a 50/50 blend, can reuse a previously allocated dojo.Color object for the result
Return the body element of the document return the body object associated with dojo.doc
similar to other library’s "$" function, takes a string representing a DOM id or a DomNode and returns the corresponding DomNode. If a Node is passed, this function is a no-op. Returns a single DOM node or null, working around several browser-specific bugs to do so.
Clones objects (including DOM nodes) and all children. Warning: do not clone cyclic structures.
builds a color from 1, 2, 3, or 4 element array
converts a hex string with a ‘#’ prefix to a color object. Supports 12-bit #rgb shorthand.
get rgb(a) array from css-style color declarations
parses str for a color value.
Functiondojo.connect(obj: Object, event: String, context: Object, method: String|Function, dontFix: Boolean)
Create a link that calls one function when another executes.
Functiondojo.connectPublisher(topic: String, obj: Object, event: String)
Ensure that everytime obj.event() is called, a message is published on the topic. Returns a handle which can be passed to dojo.disconnect() to disable subsequent automatic publication on the topic.
getter/setter for the content-box of node.
Functiondojo.cookie(name: String, value: String?, props: dojo.__cookieProps?)
Get or set a cookie.
Functiondojo.coords(node: DomNode|String, includeScroll: Boolean?)
Returns an object that measures margin box width/height and absolute positioning data from dojo.abs(). Return value will be in the form: { l: 50, t: 200, w: 300: h: 150, x: 100, y: 300 } does not act as a setter. If includeScroll is passed, the x and y params are affected as one would expect in dojo.abs().
Functiondojo.declare(className: String, superclass: Function, props: Object)
Create a feature-rich constructor from compact notation
Functiondojo.delegate(obj, props)
Functiondojo.deprecated(behaviour: String, extra: String?, removal: String?)
Log a debug message to indicate that a behavior has been deprecated.
Remove a link created by dojo.connect.
Functiondojo.eval(scriptFragment: String)
Perform an evaluation in the global scope. Use this rather than calling ‘eval()’ directly.
Functiondojo.every(arr: Array|String, callback: Function|String, thisObject: Object?)
Determines whether or not every item in arr satisfies the condition implemented by callback.
Functiondojo.exists(name: String, obj: Object?)
determine if an object supports a given method
Functiondojo.exit(exitcode)
Functiondojo.experimental(moduleName: String, extra: String?)
Marks code as experimental.
Functiondojo.extend(constructor: Object, props: Object...)
Adds all properties and methods of props to constructor’s prototype, making them available to all instances created with
Returns an animation that will fade node defined in ‘args’ from its current opacity to fully opaque.
Returns an animation that will fade node defined in ‘args’ from its current opacity to fully transparent.
Functiondojo.filter(arr: Array, callback: Function|String, thisObject: Object?)
Returns a new Array with those items from arr that match the condition implemented by callback.
Functiondojo.fixEvent(evt, sender: DOMNode)
normalizes properties on the event object including event bubbling methods, keystroke normalization, and x/y positions
Functiondojo.forEach(arr: Array|String, callback: Function|String, thisObject: Object?)
for every item in arr, callback is invoked. Return values are ignored.
Functiondojo.formToJson(formNode: DOMNode|String, prettyPrint: Boolean?)
return a serialized JSON string from a form node or string ID identifying the form to serialize
dojo.formToObject returns the values encoded in an HTML form as string properties in an object which it then returns. Disabled form elements, buttons, and other non-value form elements are skipped. Multi-select elements are returned as an array of string values.
return URL-encoded string representing the form passed as either a node or string ID identifying the form to serialize
evaluates the passed string-form of a JSON object
Returns a "computed style" object.
Functiondojo.getObject(name: String, create: Boolean, context: Object)
Get a property from a dot-separated string, such as "A.B.C"
Returns true if the requested attribute is specified on the given element, and false otherwise.
Functiondojo.hasClass(node: DomNode|String, classStr: String)
Returns whether or not the specified classes are a portion of the class list currently applied to the node.
Functiondojo.hitch(scope: Object, method: Function...)
Returns a function that will only ever execute in the a given scope. This allows for easy use of object member functions in callbacks and other places in which the "this" keyword may otherwise not reference the expected scope. Any number of default positional arguments may be passed as parameters beyond "method". Each of these values will be used to "placehold" (similar to curry) for the hitched function.
Functiondojo.indexOf(array: Array, value: Object, fromIndex: Integer?, findLast: Boolean?)
locates the first index of the provided value in the passed array. If the value is not found, -1 is returned.
Returns true if it is a built-in function or some other kind of oddball that should report as a function but doesn’t
Return true if it is an Array
similar to dojo.isArray() but more permissive
Returns true if node is a descendant of ancestor
Return true if it is a Function
Returns true if it is a JavaScript object (or an Array, a Function or null)
Return true if it is a String
Functiondojo.lastIndexOf(array: Array, value: Object, fromIndex: Integer?)
locates the last index of the provided value in the passed array. If the value is not found, -1 is returned.
Functiondojo.map(arr: Array|String, callback: Function|String, thisObject: Function?)
applies callback to each element of arr and returns an Array with the results
getter/setter for the margin-box of node.
Functiondojo.mixin(obj: Object, props: Object...)
Adds all properties and methods of props to obj and returns the (now modified) obj.
Returns a dojo._Url object relative to a module.
takes a name/value mapping object and returns a string representing a URL-encoded version of that object.
Functiondojo.partial(method: Function...)
similar to hitch() except that the scope object is left to be whatever the execution context eventually becomes.
Functiondojo.place(node: String|DomNode, refNode: String|DomNode, position: String|Number)
attempt to insert node in relation to ref based on position
require one or more modules based on which host environment Dojo is currently operating in
Functiondojo.provide(resourceName)
Each javascript source file must have at least one dojo.provide() call at the top of the file, corresponding to the file name. For example, js/dojo/foo.js must have dojo.provide(&quot;dojo.foo&quot;); before any calls to dojo.require() are made.
Functiondojo.publish(topic: String, args: Array)
Invoke all listener method subscribed to topic.
Functiondojo.query(query: String, root: String|DOMNode?)
Returns nodes which match the given CSS3 selector, searching the entire document by default but optionally taking a node to scope the search by. Returns an instance of dojo.NodeList.
maps a module name to a path
Removes an attribute from an HTML element.
Removes the specified classes from node.
Functiondojo.require(moduleName: String, omitModuleCheck: Boolean?)
loads a Javascript module from the appropriate URI
Functiondojo.requireIf(condition: Boolean, resourceName: String)
If the condition is true then call dojo.require() for the specified resource
Functiondojo.requireLocalization(moduleName: String, bundleName: String, locale: String?, availableFlatLocales: String)
Declares translated resources and loads them if necessary, in the same style as dojo.require. Contents of the resource bundle are typically strings, but may be any name/value pair, represented in JSON format. See also dojo.i18n.getLocalization.
Functiondojo.setContext(globalObject: Object, globalDocument: DocumentElement)
changes the behavior of many core Dojo functions that deal with namespace and DOM lookup, changing them to work in a new global context (e.g., an iframe). The varibles dojo.global and dojo.doc are modified as a result of calling this function and the result of dojo.body() likewise differs.
Functiondojo.setObject(name: String, value: Object, context: Object?)
Set a property from a dot-separated string, such as "A.B.C"
enable or disable selection on a node
Functiondojo.some(arr: Array|String, callback: Function|String, thisObject: Object?)
Determines whether or not any item in arr satisfies the condition implemented by callback.
prevents propagation and clobbers the default action of the passed event
Functiondojo.style(node: DomNode|String, style: Object?, value: String?)
gets or sets a style property on node. If 2 arguments are passed, acts as a getter. If value is passed, acts as a setter for the property.
Functiondojo.subscribe(topic: String, context: Object, method: String|Function)
Attach a listener to a named topic. The listener function is invoked whenever the named topic is published (see: dojo.publish). Returns a handle which is needed to unsubscribe this listener.
Functiondojo.toggleClass(node: DomNode|String, classStr: String, condition: Boolean?)
Adds a class to node if not present, or removes if present. Pass a boolean condition if you want to explicitly add or remove.
Functiondojo.toJson(it: Object, prettyPrint: Boolean?, _indentStr: String?)
Create a JSON serialization of an object. Note that this doesn’t check for infinite recursion, so don’t do that!
trims whitespaces from both sides of the string
signal fired by impending environment destruction. You may use dojo.addOnUnload() or dojo.connect() to this method to perform page/application cleanup methods.
Remove a topic listener.
Functiondojo.withDoc(documentObject: Object, callback: Function, thisObject: Object?, cbArguments: Array?)
Call callback with documentObject as dojo.doc. If provided,
Functiondojo.withGlobal(globalObject: Object, callback: Function, thisObject: Object?, cbArguments: Array?)
Call callback with globalObject as dojo.global and
Functiondojo.xdRequireLocalization(moduleName: String, bundleName: String, locale: String?, availableFlatLocales: String)
Internal xd loader function. The xd version of dojo.requireLocalization.
Functiondojo.xhr(method: String, args: dojo.__XhrArgs, hasBody: Boolean?)
Sends an HTTP request with the given method. If the request has an HTTP body, then pass true for hasBody. The method argument should be uppercase. Also look at dojo.xhrGet(), xhrPost(), xhrPut() and dojo.xhrDelete() for shortcuts for those HTTP methods. There are also methods for "raw" PUT and POST methods via dojo.rawXhrPut() and dojo.rawXhrPost() respectively.
Sends an HTTP DELETE request to the server.
Sends an HTTP GET request to the server.
Sends an HTTP POST request to the server.
Sends an HTTP PUT request to the server.
Functiondojo._abs(node: DomNode, includeScroll: Boolean?)
Gets the position of the passed element relative to the viewport (if includeScroll==false), or relative to the document root (if includeScroll==true). Returns an object of the form: { x: 100, y: 300 } if includeScroll is passed, the x and y values will include any document offsets that may affect the position relative to the viewport.
The default easing function for dojo._Animation(s)
Functiondojo._delegate(obj, props)
removes node from its parent, clobbers it and all of its children.
Functiondojo._disconnect(obj, event, handle, listener)
Adds escape sequences for non-visual characters, double quote and backslash and surrounds with double quotes to form a valid string literal.