subscribe

tests

toJsonIndentStr

touch

This module provides unified touch event handlers by exporting press, move, release and cancel which can also run well on desktop. Based on http://dvcs.w3.org/hg/webevents/raw-file/tip/touchevents.html Also, if the dojoClick property is set to truthy on a DOM node, dojo/touch generates click events immediately for this node and its descendants (except for descendants that have a dojoClick property set to falsy), to avoid the delay before native browser click events, and regardless of whether evt.preventDefault() was called in a touch.press event listener.

window

Methods

AdapterRegistry(returnWrappers)

Objects of this class keep list of arrays in the form [name, check, wrap, directReturn] that are used to determine what the contextual result of a set of checked arguments is. All check/wrap functions in this registry should be of the same arity.

Parameter

Type

Description

returnWrappers

Boolean

Optional

Examples

Example 1

// create a new registry
require(["dojo/AdapterRegistry"],
function(AdapterRegistry){
var reg = new AdapterRegistry();
reg.register("handleString",
function(str){
return typeof val == "string"
},
function(str){
// do something with the string here
}
);
reg.register("handleArr",
dojo.isArray,
function(arr){
// do something with the array here
}
);
// now we can pass reg.match() *either* an array or a string and
// the value we pass will get handled by the right function
reg.match("someValue"); // will call the first function
reg.match(["someValue"]); // will call the second
});

addOnUnload(obj,functionName)

Registers a function to be triggered when the page unloads. Deprecated, use on(window, "beforeunload", lang.hitch(obj, functionName)) instead.

The first time that addOnUnload is called Dojo will register a page listener to trigger your unload handler with.

In a browser environment, the functions will be triggered during the window.onbeforeunload event. Be careful of doing too much work in an unload handler. onbeforeunload can be triggered if a link to download a file is clicked, or if the link is a javascript: link. In these cases, the onbeforeunload event fires, but the document is not actually destroyed. So be careful about doing destructive operations in a dojo.addOnUnload callback.

Further note that calling dojo.addOnUnload will prevent browsers from using a "fast back" cache to make page loading via back button instantaneous.

addOnWindowUnload(obj,functionName)

registers a function to be triggered when window.onunload fires. Be careful trying to modify the DOM or access JavaScript properties during this phase of page unloading: they may not always be available. Consider dojo.addOnUnload() if you need to modify the DOM or do heavy JavaScript work.

anim(node,properties,duration,easing,onEnd,delay)

A simpler interface to animateProperty(), also returns an instance of Animation but begins the animation immediately, unlike nearly every other Dojo animation API.

Simpler (but somewhat less powerful) version of animateProperty. It uses defaults for many basic properties and allows for positional parameters to be used in place of the packed "property bag" which is used for other Dojo animation methods.

The Animation object returned will be already playing, so calling play() on it again is (usually) a no-op.

Parameter

Type

Description

node

DOMNode | String

a DOM node or the id of a node to animate CSS properties on

properties

Object

duration

Integer

Optional

The number of milliseconds over which the animation should run. Defaults to the global animation default duration (350ms).

easing

Function

Optional

An easing function over which to calculate acceleration and deceleration of the animation through its duration. A default easing algorithm is provided, but you may plug in any you wish. A large selection of easing algorithms are available in dojo/fx/easing.

onEnd

Function

Optional

A function to be called when the animation finishes running.

delay

Integer

Optional

The number of milliseconds to delay beginning the animation by. The default is 0.

Note 'paddingTop' is used over 'padding-top'. Multi-name CSS properties

are written using "mixed case", as the hyphen is illegal as an object key.

Example 3

Plug in a different easing function and register a callback for when the animation ends. Easing functions accept values between zero and one and return a value on that basis. In this case, an exponential-in curve.

Animation(args)

A generic animation class that fires callbacks into its handlers object at various states.

A generic animation class that fires callbacks into its handlers object at various states. Nearly all dojo animation functions return an instance of this method, usually without calling the .play() method beforehand. Therefore, you will likely need to call .play() on instances of Animation when one is returned.

Parameter

Type

Description

args

Object

The 'magic argument', mixing all the properties into this animation instance.

attr(node,name,value)

Handles normalized getting and setting of attributes on DOM Nodes. If 2 arguments are passed, and a the second argument is a string, acts as a getter.

If a third argument is passed, or if the second argument is a map of attributes, acts as a setter.

When passing functions as values, note that they will not be directly assigned to slots on the node, but rather the default behavior will be removed and the new behavior will be added using dojo.connect(), meaning that event handler properties will be normalized and that some caveats with regards to non-standard behaviors for onsubmit apply. Namely that you should cancel form submission using dojo.stopEvent() on the passed event object instead of returning a boolean value from the handler itself.

Parameter

Type

Description

node

DOMNode | String

id or reference to the element to get or set the attribute on

name

String | Object

the name of the attribute to get or set.

value

String

Optional

The value to set for the attribute

Returns: any | undefined

when used as a getter, the value of the requested attribute or null if that attribute does not have a specified or default value;

when used as a setter, the DOM node

Examples

Example 1

// get the current value of the "foo" attribute on a node
dojo.attr(dojo.byId("nodeId"), "foo");
// or we can just pass the id:
dojo.attr("nodeId", "foo");

Example 2

// use attr() to set the tab index
dojo.attr("nodeId", "tabIndex", 3);

Example 3

Set multiple values at once, including event handlers:

dojo.attr("formId", {
"foo": "bar",
"tabIndex": -1,
"method": "POST",
"onsubmit": function(e){
// stop submitting the form. Note that the IE behavior
// of returning true or false will have no effect here
// since our handler is connect()ed to the built-in
// onsubmit behavior and so we need to use
// dojo.stopEvent() to ensure that the submission
// doesn't proceed.
dojo.stopEvent(e);
// submit the form with Ajax
dojo.xhrPost({ form: "formId" });
}
});

cache(module,url,value)

A getter and setter for storing the string content associated with the module and url arguments.

If module is a string that contains slashes, then it is interpretted as a fully resolved path (typically a result returned by require.toUrl), and url should not be provided. This is the preferred signature. If module is a string that does not contain slashes, then url must also be provided and module and url are used to call dojo.moduleUrl() to generate a module URL. This signature is deprecated. If value is specified, the cache value for the moduleUrl will be set to that value. Otherwise, dojo.cache will fetch the moduleUrl and store it in its internal cache and return that cached value for the URL. To clear a cache value pass null for value. Since XMLHttpRequest (XHR) is used to fetch the the URL contents, only modules on the same domain of the page can use this capability. The build system can inline the cache values though, to allow for xdomain hosting.

Parameter

Type

Description

module

String | Object

dojo/cldr/supplemental

url

String

The rest of the path to append to the path derived from the module argument. If module is an object, then this second argument should be the "value" argument instead.

value

String | Object

Optional

If a String, the value to use in the cache for the module/url combination. If an Object, it can have two properties: value and sanitize. The value property should be the value to use in the cache, and sanitize can be set to true or false, to indicate if XML declarations should be removed from the value and if the HTML inside a body tag in the value should be extracted as the real value. The value argument or the value property on the value argument are usually only used by the build system as it inlines cache content.

Returns: undefined | null

Examples

Example 1

To ask dojo.cache to fetch content and store it in the cache (the dojo["cache"] style of call is used to avoid an issue with the build system erroneously trying to intern this example. To get the build system to intern your dojo.cache calls, use the "dojo.cache" style of call):

Example 2

To ask dojo.cache to fetch content and store it in the cache, and sanitize the input (the dojo["cache"] style of call is used to avoid an issue with the build system erroneously trying to intern this example. To get the build system to intern your dojo.cache calls, use the "dojo.cache" style of call):

colorFromString(str,obj)

Acceptable input values for str may include arrays of any form accepted by dojo.colorFromArray, hex strings such as "#aaaaaa", or rgb or rgba strings such as "rgb(133, 200, 16)" or "rgba(10, 10, 10, 50)"

connect(obj,event,context,method,dontFix)

dojo.connect is a deprecated event handling and delegation method in Dojo. It allows one function to "listen in" on the execution of any other, triggering the second whenever the first is called. Many listeners may be attached to a function, and source functions may be either regular function calls or DOM events.

Connects listeners to actions, so that after event fires, a listener is called with the same arguments passed to the original function.

Since dojo.connect allows the source of events to be either a "regular" JavaScript function or a DOM event, it provides a uniform interface for listening to all the types of events that an application is likely to deal with though a single, unified interface. DOM programmers may want to think of it as "addEventListener for everything and anything".

When setting up a connection, the event parameter must be a string that is the name of the method/event to be listened for. If obj is null, kernel.global is assumed, meaning that connections to global methods are supported but also that you may inadvertently connect to a global by passing an incorrect object name or invalid reference.

dojo.connect generally is forgiving. If you pass the name of a function or method that does not yet exist on obj, connect will not fail, but will instead set up a stub method. Similarly, null arguments may simply be omitted such that fewer than 4 arguments may be required to set up a connection See the examples for details.

The return value is a handle that is needed to remove this connection with dojo.disconnect.

Parameter

Type

Description

obj

Object

Optional

The source object for the event function. Defaults to kernel.global if null. If obj is a DOM node, the connection is delegated to the DOM event manager (unless dontFix is true).

event

String

String name of the event function in obj. I.e. identifies a property obj[event].

context

Object | null

The object that method will receive as "this".

If context is null and method is a function, then method inherits the context of event.

If method is a string then context must be the source object object for method (context[method]). If context is null, kernel.global is used.

method

String | Function

A function reference, or name of a function in context. The function identified by method fires after event does. method receives the same arguments as the event. See context argument comments for information on method's scope.

dontFix

Boolean

Optional

If obj is a DOM node, set dontFix to true to prevent delegation of this connection to the DOM event manager.

contentBox(node,box)

Returns an object in the expected format of box (regardless if box is passed). The object might look like: { l: 50, t: 200, w: 300: h: 150 } for a node offset from its parent 50px to the left, 200px from the top with a content width of 300px and a content-height of 150px. Note that the content box may have a much larger border or margin box, depending on the box model currently in use and CSS values set/inherited for node. While the getter will return top and left values, the setter only accepts setting the width and height.

Parameter

Type

Description

node

DomNode | String

id or reference to DOM Node to get/set box for

box

Object

Optional

If passed, denotes that dojo.contentBox() should update/set the content box for node. Box is an object in the above format, but only w (width) and h (height) are supported. All properties are optional if passed.

Example 3

coords(node,includeScroll)

Deprecated: Use position() for border-box x/y/w/h or marginBox() for margin-box w/h/l/t.

Returns an object that measures margin-box (w)idth/(h)eight and absolute position x/y of the border-box. Also returned is computed (l)eft and (t)op values in pixels from the node's offsetParent as returned from marginBox(). Return value will be in the form:

create(tag,attrs,refNode,pos)

Create an element, allowing for optional attribute decoration and placement.

A DOM Element creation function. A shorthand method for creating a node or a fragment, and allowing for a convenient optional attribute setting step, as well as an optional DOM placement reference.

Attributes are set by passing the optional object through dojo.setAttr. See dojo.setAttr for noted caveats and nuances, and API if applicable.

Placement is done via dojo.place, assuming the new node to be the action node, passing along the optional reference node and position.

Parameter

Type

Description

tag

DOMNode | String

A string of the element to create (eg: "div", "a", "p", "li", "script", "br"), or an existing DOM node to process.

attrs

Object

An object-hash of attributes to set on the newly created node. Can be null, if you don't want to set any attributes/styles. See: dojo.setAttr for a description of available attributes.

refNode

DOMNode | String

Optional

Optional reference node. Used by dojo.place to place the newly created node somewhere in the dom relative to refNode. Can be a DomNode reference or String ID of a node.

pos

String

Optional

Optional positional reference. Defaults to "last" by way of dojo.place, though can be set to "first","after","before","last", "replace" or "only" to further control the placement of the new node relative to the refNode. 'refNode' is required if a 'pos' is specified.

"className" is cached in "declaredClass" property of the new class, if it was supplied. The immediate super class will be cached in "superclass" property of the new class.

Methods in "props" will be copied and modified: "nom" property (the declared name of the method) will be added to all copied functions to help identify them for the internal machinery. Be very careful, while reusing methods: if you use the same function under different names, it can produce errors in some cases.

It is possible to use constructors created "manually" (without declare()) as bases. They will be called as usual during the creation of an instance, their methods will be chained, and even called by "this.inherited()".

Special property "-chains-" governs how to chain methods. It is a dictionary, which uses method names as keys, and hint strings as values. If a hint string is "after", this method will be called after methods of its base classes. If a hint string is "before", this method will be called before methods of its base classes.

If "constructor" is not mentioned in "-chains-" property, it will be chained using the legacy mode: using "after" chaining, calling preamble() method before each constructor, if available, and calling postscript() after all constructors were executed. If the hint is "after", it is chained as a regular method, but postscript() will be called after the chain of constructors. "constructor" cannot be chained "before", but it allows a special hint string: "manual", which means that constructors are not going to be chained in any way, and programmer will call them manually using this.inherited(). In the latter case postscript() will be called after the construction.

All chaining hints are "inherited" from base classes and potentially can be overridden. Be very careful when overriding hints! Make sure that all chained methods can work in a proposed manner of chaining.

Once a method was chained, it is impossible to unchain it. The only exception is "constructor". You don't need to define a method in order to supply a chaining hint.

If a method is chained, it cannot use this.inherited() because all other methods in the hierarchy will be called automatically.

Usually constructors and initializers of any kind are chained using "after" and destructors of any kind are chained as "before". Note that chaining assumes that chained methods do not return any value: any returned value will be discarded.

Parameter

Type

Description

className

String

Optional

The optional name of the constructor (loosely, a "class") stored in the "declaredClass" property in the created prototype. It will be used as a global name for a created constructor.

superclass

Function | Function[]

May be null, a Function, or an Array of Functions. This argument specifies a list of bases (the left-most one is the most deepest base).

props

Object

An object whose properties are copied to the created prototype. Add an instance-initialization function by making it a property named "constructor".

Deferred(canceller)

Deprecated. This module defines the legacy dojo/_base/Deferred API. New code should use dojo/Deferred instead.

The Deferred API is based on the concept of promises that provide a generic interface into the eventual completion of an asynchronous action. The motivation for promises fundamentally is about creating a separation of concerns that allows one to achieve the same type of call patterns and logical data flow in asynchronous code as can be achieved in synchronous code. Promises allows one to be able to call a function purely with arguments needed for execution, without conflating the call with concerns of whether it is sync or async. One shouldn't need to alter a call's arguments if the implementation switches from sync to async (or vice versa). By having async functions return promises, the concerns of making the call are separated from the concerns of asynchronous interaction (which are handled by the promise).

The Deferred is a type of promise that provides methods for fulfilling the promise with a successful result or an error. The most important method for working with Dojo's promises is the then() method, which follows the CommonJS proposed promise API. An example of using a Dojo promise:

The .then() call returns a new promise that represents the result of the execution of the callback. The callbacks will never affect the original promises value.

The Deferred instances also provide the following functions for backwards compatibility:

addCallback(handler)

addErrback(handler)

callback(result)

errback(result)

Callbacks are allowed to return promises themselves, so you can build complicated sequences of events with ease.

The creator of the Deferred may specify a canceller. The canceller is a function that will be called if Deferred.cancel is called before the Deferred fires. You can use this to implement clean aborting of an XMLHttpRequest, etc. Note that cancel will fire the deferred with a CancelledError (unless your canceller returns another kind of error), so the errbacks should be prepared to handle that error for cancellable Deferreds.

Parameter

Type

Description

canceller

Function

Optional

Examples

Example 1

Example 2

Deferred objects are often used when making code asynchronous. It may be easiest to write functions in a synchronous manner and then split code using a deferred to trigger a response to a long-lived operation. For example, instead of register a callback function to denote when a rendering operation completes, the function can simply return a deferred:

Example 3

Using a Deferred doesn't simplify the sending code any, but it provides a standard interface for callers and senders alike, providing both with a simple way to service multiple callbacks for an operation and freeing both sides from worrying about details such as "did this get called already?". With Deferreds, new callbacks can be added at any time.

Deprecated, use dojo/promise/all instead. Provides event handling for a group of Deferred objects.

DeferredList takes an array of existing deferreds and returns a new deferred of its own this new deferred will typically have its callback fired when all of the deferreds in the given list have fired their own deferreds. The parameters fireOnOneCallback and fireOnOneErrback, will fire before all the deferreds as appropriate

Parameter

Type

Description

list

Array

The list of deferreds to be synchronizied with this DeferredList

fireOnOneCallback

Boolean

Optional

Will cause the DeferredLists callback to be fired as soon as any of the deferreds in its list have been fired instead of waiting until the entire list has finished

empty(node)

eval(scriptText)

A legacy method created for use exclusively by internal Dojo methods. Do not use this method directly unless you understand its possibly-different implications on the platforms your are targeting.

Makes an attempt to evaluate scriptText in the global scope. The function works correctly for browsers that support indirect eval.

As usual, IE does not. On IE, the only way to implement global eval is to use execScript. Unfortunately, execScript does not return a value and breaks some current usages of dojo.eval. This implementation uses the technique of executing eval in the scope of a function that is a single scope frame below the global scope; thereby coming close to the global scope. Note carefully that

dojo.eval("var pi = 3.14;");

will define global pi in non-IE environments, but define pi only in a temporary local scope for IE. If you want to define a global variable using dojo.eval, write something like

exit(exitcode)

experimental(moduleName,extra)

This can be used to mark a function, file, or module as experimental. Experimental code is not ready to be used, and the APIs are subject to change without notice. Experimental code may be completed deleted without going through the normal deprecation process.

Parameter

Type

Description

moduleName

String

The name of a module, or the name of a module file or a specific function

fieldToObject(inputNode)

Returns the value encoded in a form field as as a string or an array of strings. Disabled form elements and unchecked radio and checkboxes are skipped. Multi-select elements are returned as an array of string values.

a function that is invoked with three arguments (item, index, array). The return of this function is expected to be a boolean which determines whether the passed-in item will be included in the returned array.

fixIeBiDiScrollLeft(scrollLeft,doc)

In RTL direction, scrollLeft should be a negative value, but IE returns a positive one. All codes using documentElement.scrollLeft must call this function to fix this error, otherwise the position will offset to right when there is a horizontal scrollbar.

Parameter

Type

Description

scrollLeft

Number

doc

Document

Optional

Optional document to query. If unspecified, use win.doc.

Returns: Number | number

forEach(arr,callback,thisObject)

for every item in arr, callback is invoked. Return values are ignored. If you want to break out of the loop, consider using array.every() or array.some(). forEach does not allow breaking out of the loop over the items in arr.

formToObject(formNode)

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.

fromJson(js)

Throws for invalid JavaScript expressions. It does not use a strict JSON parser. It always delegates to eval(). The content passed to this method must therefore come from a trusted source. It is recommend that you use dojo/json's parse function for an implementation uses the (faster) native JSON parse when available.

the value of the requested attribute or null if that attribute does not have a specified or default value;

Examples

Example 1

// get the current value of the "foo" attribute on a node
require(["dojo/dom-attr", "dojo/dom"], function(domAttr, dom){
domAttr.get(dom.byId("nodeId"), "foo");
// or we can just pass the id:
domAttr.get("nodeId", "foo");
});

getBorderExtents(node,computedStyle)

returns an object with properties useful for noting the border dimensions.

l/t/r/b = the sum of left/top/right/bottom border (respectively)

w = the sum of the left and right border

h = the sum of the top and bottom border

The w/h are used for calculating boxes. Normally application code will not need to invoke this directly, and will use the ...box... functions instead.

Parameter

Type

Description

node

DOMNode

computedStyle

Object

Optional

This parameter accepts computed styles object. If this parameter is omitted, the functions will call dojo/dom-style.getComputedStyle to get one. It is a better way, calling dojo/dom-style.getComputedStyle once, and then pass the reference to this computedStyle parameter. Wherever possible, reuse the returned object of dojo/dom-style.getComputedStyle().

getContentBox(node,computedStyle)

Returns an object that encodes the width, height, left and top positions of the node's content box, irrespective of the current box model.

Parameter

Type

Description

node

DOMNode

computedStyle

Object

Optional

This parameter accepts computed styles object. If this parameter is omitted, the functions will call dojo/dom-style.getComputedStyle to get one. It is a better way, calling dojo/dom-style.getComputedStyle once, and then pass the reference to this computedStyle parameter. Wherever possible, reuse the returned object of dojo/dom-style.getComputedStyle().

such as node.offsetLeft, node.offsetTop, node.style.left and node.style.top. The offset is always (2, 2) in LTR direction. When the body is in RTL direction, the offset counts the width of left scroll bar's width. This function computes the actual offset.

getL10nName(moduleName,bundleName,locale)

getMarginBox(node,computedStyle)

returns an object that encodes the width, height, left and top positions of the node's margin box.

Parameter

Type

Description

node

DOMNode

computedStyle

Object

Optional

This parameter accepts computed styles object. If this parameter is omitted, the functions will call dojo/dom-style.getComputedStyle to get one. It is a better way, calling dojo/dom-style.getComputedStyle once, and then pass the reference to this computedStyle parameter. Wherever possible, reuse the returned object of dojo/dom-style.getComputedStyle().

getMarginExtents(node,computedStyle)

returns object with properties useful for box fitting with regards to box margins (i.e., the outer-box).

l/t = marginLeft, marginTop, respectively

w = total width, margin inclusive

h = total height, margin inclusive

The w/h are used for calculating boxes. Normally application code will not need to invoke this directly, and will use the ...box... functions instead.

Parameter

Type

Description

node

DOMNode

computedStyle

Object

Optional

This parameter accepts computed styles object. If this parameter is omitted, the functions will call dojo/dom-style.getComputedStyle to get one. It is a better way, calling dojo/dom-style.getComputedStyle once, and then pass the reference to this computedStyle parameter. Wherever possible, reuse the returned object of dojo/dom-style.getComputedStyle().

Returns: object

getMarginSize(node,computedStyle)

returns an object that encodes the width and height of the node's margin box

Parameter

Type

Description

node

DOMNode | String

computedStyle

Object

Optional

This parameter accepts computed styles object. If this parameter is omitted, the functions will call dojo/dom-style.getComputedStyle to get one. It is a better way, calling dojo/dom-style.getComputedStyle once, and then pass the reference to this computedStyle parameter. Wherever possible, reuse the returned object of dojo/dom-style.getComputedStyle().

The w/h are used for calculating boxes. Normally application code will not need to invoke this directly, and will use the ...box... functions instead.

Parameter

Type

Description

node

DOMNode

computedStyle

Object

Optional

This parameter accepts computed styles object. If this parameter is omitted, the functions will call dojo/dom-style.getComputedStyle to get one. It is a better way, calling dojo/dom-style.getComputedStyle once, and then pass the reference to this computedStyle parameter. Wherever possible, reuse the returned object of dojo/dom-style.getComputedStyle().

getPadExtents(node,computedStyle)

Returns object with special values specifically useful for node fitting.

Returns an object with w, h, l, t properties:

l/t/r/b = left/top/right/bottom padding (respectively)
w = the total of the left and right padding
h = the total of the top and bottom padding

If 'node' has position, l/t forms the origin for child nodes.

The w/h are used for calculating boxes. Normally application code will not need to invoke this directly, and will use the ...box... functions instead.

Parameter

Type

Description

node

DOMNode

computedStyle

Object

Optional

This parameter accepts computed styles object. If this parameter is omitted, the functions will call dojo/dom-style.getComputedStyle to get one. It is a better way, calling dojo/dom-style.getComputedStyle once, and then pass the reference to this computedStyle parameter. Wherever possible, reuse the returned object of dojo/dom-style.getComputedStyle().

Examples

Example 1

// get the current value of the "foo" property on a node
require(["dojo/dom-prop", "dojo/dom"], function(domProp, dom){
domProp.get(dom.byId("nodeId"), "foo");
// or we can just pass the id:
domProp.get("nodeId", "foo");
});

Examples

Example 1

marginBox(node,box)

Getter/setter for the margin-box of node. Returns an object in the expected format of box (regardless if box is passed). The object might look like: { l: 50, t: 200, w: 300: h: 150 } for a node offset from its parent 50px to the left, 200px from the top with a margin width of 300px and a margin-height of 150px.

Parameter

Type

Description

node

DomNode | String

id or reference to DOM Node to get/set box for

box

Object

Optional

If passed, denotes that dojo.marginBox() should update/set the margin box for node. Box is an object in the above format. All properties are optional if passed.

Example 2

you may de-reference as far as you like down the package hierarchy. This is sometimes handy to avoid lengthy relative urls or for building portable sub-packages. In this example, the acme.widget and acme.util directories may be located under different roots (see dojo.registerModulePath) but the the modules which reference them can be unaware of their relative locations on the filesystem:

NodeList(array)

Array-like object 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.

NodeList instances provide many utilities that reflect core Dojo APIs for Array iteration and manipulation, DOM manipulation, and event handling. Instead of needing to dig up functions in the dojo package, NodeLists generally make the full power of Dojo available for DOM manipulation tasks in a simple, chainable way.

platformRequire(modMap)

require one or more modules based on which host environment Dojo is currently operating in

This method takes a "map" of arrays which one can use to optionally load dojo modules. The map is indexed by the possible dojo.name values, with two additional values: "default" and "common". The items in the "default" array will be loaded if none of the other items have been chosen based on dojo.name, set by your host environment. The items in the "common" array will always be loaded, regardless of which list is chosen.

position(node,includeScroll)

Gets the position and size 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, w: 20, h: 15 }. If includeScroll==true, the x and y values will include any document offsets that may affect the position relative to the viewport. Uses the border-box model (inclusive of border and padding but not margin). Does not act as a setter.

prop(node,name,value)

Handles normalized getting and setting of properties on DOM Nodes. If 2 arguments are passed, and a the second argument is a string, acts as a getter.

If a third argument is passed, or if the second argument is a map of attributes, acts as a setter.

When passing functions as values, note that they will not be directly assigned to slots on the node, but rather the default behavior will be removed and the new behavior will be added using dojo.connect(), meaning that event handler properties will be normalized and that some caveats with regards to non-standard behaviors for onsubmit apply. Namely that you should cancel form submission using dojo.stopEvent() on the passed event object instead of returning a boolean value from the handler itself.

Parameter

Type

Description

node

DomNode | String

id or reference to the element to get or set the property on

name

String | Object

the name of the property to get or set.

value

String

Optional

The value to set for the property

Returns: any

when used as a getter, the value of the requested property or null if that attribute does not have a specified or default value;

when used as a setter, the DOM node

Examples

Example 1

// get the current value of the "foo" property on a node
dojo.prop(dojo.byId("nodeId"), "foo");
// or we can just pass the id:
dojo.prop("nodeId", "foo");

Example 2

// use prop() to set the tab index
dojo.prop("nodeId", "tabIndex", 3);

Example 3

Set multiple values at once, including event handlers:

dojo.prop("formId", {
"foo": "bar",
"tabIndex": -1,
"method": "POST",
"onsubmit": function(e){
// stop submitting the form. Note that the IE behavior
// of returning true or false will have no effect here
// since our handler is connect()ed to the built-in
// onsubmit behavior and so we need to use
// dojo.stopEvent() to ensure that the submission
// doesn't proceed.
dojo.stopEvent(e);
// submit the form with Ajax
dojo.xhrPost({ form: "formId" });
}
});

provide(mid)

pushContext(g,d)

causes subsequent calls to Dojo methods to assume the passed object and, optionally, document as the default scopes to use. A 2-element array of the previous global and document are returned.

dojo.pushContext treats contexts as a stack. The auto-detected contexts which are initially provided using dojo.setContext() require authors to keep state in order to "return" to a previous context, whereas the dojo.pushContext and dojo.popContext methods provide a more natural way to augment blocks of code to ensure that they execute in a different window or frame without issue. If called without any arguments, the default context (the context when Dojo is first loaded) is instead pushed into the stack. If only a single string is passed, a node in the intitial context's document is looked up and its contextWindow and contextDocument properties are used as the context to push. This means that iframes can be given an ID and code can be executed in the scope of the iframe's document in subsequent calls easily.

Parameter

Type

Description

g

Object | String

Optional

The global context. If a string, the id of the frame to search for a context and document.

false is default. Indicates whether the request should be a synchronous (blocking) request.

headers (Object, optional):

Additional HTTP headers to send in the request.

failOk (Boolean, optional):

false is default. Indicates whether a request should be allowed to fail (and therefore no console error message in the event of a failure)

contentType (String|Boolean):

"application/x-www-form-urlencoded" is default. Set to false to prevent a Content-Type header from being sent, or to a string to send a different Content-Type.

load:

This function will be called on a successful HTTP response code.

error:

This function will be called when the request fails due to a network or server error, the url is invalid, etc. It will also be called if the load or handle callback throws an exception, unless djConfig.debugAtAllCosts is true. This allows deployed applications to continue to run even when a logic error happens in the callback, while making it easier to troubleshoot while in debug mode.

handle:

This function will be called at the end of every request, whether or not an error occurs.

url (String):

URL to server endpoint.

content (Object, optional):

Contains properties with string values. These properties will be serialized as name1=value2 and passed in the request.

timeout (Integer, optional):

Milliseconds to wait for the response. If this time passes, the then error callbacks are called.

form (DOMNode, optional):

DOM node for a form. Used to extract the form values and send to the server.

preventCache (Boolean, optional):

Default is false. If true, then a "dojo.preventCache" parameter is sent in the request with a value that changes with each request (timestamp). Useful only with GET-type requests.

rawBody (String, optional):

Sets the raw body for an HTTP request. If this is used, then the content property is ignored. This is mostly useful for HTTP methods that have a body to their requests, like PUT or POST. This property can be used instead of postData and putData for dojo/_base/xhr.rawXhrPost and dojo/_base/xhr.rawXhrPut respectively.

ioPublish (Boolean, optional):

Set this explicitly to false to prevent publishing of topics related to IO operations. Otherwise, if djConfig.ioPublish is set to true, topics will be published via dojo/topic.publish() for different phases of an IO operation. See dojo/main.__IoPublish for a list of topics that are published.

false is default. Indicates whether the request should be a synchronous (blocking) request.

headers (Object, optional):

Additional HTTP headers to send in the request.

failOk (Boolean, optional):

false is default. Indicates whether a request should be allowed to fail (and therefore no console error message in the event of a failure)

contentType (String|Boolean):

"application/x-www-form-urlencoded" is default. Set to false to prevent a Content-Type header from being sent, or to a string to send a different Content-Type.

load:

This function will be called on a successful HTTP response code.

error:

This function will be called when the request fails due to a network or server error, the url is invalid, etc. It will also be called if the load or handle callback throws an exception, unless djConfig.debugAtAllCosts is true. This allows deployed applications to continue to run even when a logic error happens in the callback, while making it easier to troubleshoot while in debug mode.

handle:

This function will be called at the end of every request, whether or not an error occurs.

url (String):

URL to server endpoint.

content (Object, optional):

Contains properties with string values. These properties will be serialized as name1=value2 and passed in the request.

timeout (Integer, optional):

Milliseconds to wait for the response. If this time passes, the then error callbacks are called.

form (DOMNode, optional):

DOM node for a form. Used to extract the form values and send to the server.

preventCache (Boolean, optional):

Default is false. If true, then a "dojo.preventCache" parameter is sent in the request with a value that changes with each request (timestamp). Useful only with GET-type requests.

rawBody (String, optional):

Sets the raw body for an HTTP request. If this is used, then the content property is ignored. This is mostly useful for HTTP methods that have a body to their requests, like PUT or POST. This property can be used instead of postData and putData for dojo/_base/xhr.rawXhrPost and dojo/_base/xhr.rawXhrPut respectively.

ioPublish (Boolean, optional):

Set this explicitly to false to prevent publishing of topics related to IO operations. Otherwise, if djConfig.ioPublish is set to true, topics will be published via dojo/topic.publish() for different phases of an IO operation. See dojo/main.__IoPublish for a list of topics that are published.

registerModulePath(moduleName,prefix)

An unregistered module is given the default path of ../[module], relative to Dojo root. For example, module acme is mapped to ../acme. If you want to use a different module name, use dojo.registerModulePath.

Parameter

Type

Description

moduleName

String

prefix

String

Examples

Example 1

If your dojo.js is located at this location in the web root:

/myapp/js/dojo/dojo/dojo.js

and your modules are located at:

/myapp/js/foo/bar.js
/myapp/js/foo/baz.js
/myapp/js/foo/thud/xyzzy.js

Your application can tell Dojo to locate the "foo" namespace by calling:

dojo.registerModulePath("foo", "../../foo");

At which point you can then use dojo.require() to load the

modules (assuming they provide() the same things which are required). The full code might be:

require(moduleName,omitModuleCheck)

Modules are loaded via dojo.require by using one of two loaders: the normal loader and the xdomain loader. The xdomain loader is used when dojo was built with a custom build that specified loader=xdomain and the module lives on a modulePath that is a whole URL, with protocol and a domain. The versions of Dojo that are on the Google and AOL CDNs use the xdomain loader.

If the module is loaded via the xdomain loader, it is an asynchronous load, since the module is added via a dynamically created script tag. This means that dojo.require() can return before the module has loaded. However, this should only happen in the case where you do dojo.require calls in the top-level HTML page, or if you purposely avoid the loader checking for dojo.require dependencies in your module by using a syntax like dojo["require"] to load the module.

Sometimes it is useful to not have the loader detect the dojo.require calls in the module so that you can dynamically load the modules as a result of an action on the page, instead of right at module load time.

Also, for script blocks in an HTML page, the loader does not pre-process them, so it does not know to download the modules before the dojo.require calls occur.

So, in those two cases, when you want on-the-fly module loading or for script blocks in the HTML page, special care must be taken if the dojo.required code is loaded asynchronously. To make sure you can execute code that depends on the dojo.required modules, be sure to add the code that depends on the modules in a dojo.addOnLoad() callback. dojo.addOnLoad waits for all outstanding modules to finish loading before executing.

This type of syntax works with both xdomain and normal loaders, so it is good practice to always use this idiom for on-the-fly code loading and in HTML script blocks. If at some point you change loaders and where the code is loaded from, it will all still work.

More on how dojo.require dojo.require("A.B") first checks to see if symbol A.B is defined. If it is, it is simply returned (nothing to do).

If it is not defined, it will look for A/B.js in the script root directory.

dojo.require throws an exception if it cannot find a file to load, or if the symbol A.B is not defined after loading.

It returns the object A.B, but note the caveats above about on-the-fly loading and HTML script blocks when the xdomain loader is loading a module.

dojo.require() does nothing about importing symbols into the current namespace. It is presumed that the caller will take care of that.

Parameter

Type

Description

moduleName

String

module name to load, using periods for separators, e.g. "dojo.date.locale". Module paths are de-referenced by dojo's internal mapping of locations to names and are disambiguated by longest prefix. See dojo.registerModulePath() for details on registering new modules.

omitModuleCheck

Boolean

Optional

if true, omitModuleCheck skips the step of ensuring that the loaded file actually defines the symbol it is referenced by. For example if it called as dojo.require("a.b.c") and the file located at a/b/c.js does not define an object a.b.c, and exception will be throws whereas no exception is raised when called as dojo.require("a.b.c", true)

Returns: any

the required namespace object

Examples

Example 1

To use dojo.require in conjunction with dojo.ready:

dojo.require("foo");
dojo.require("bar");
dojo.addOnLoad(function(){
//you can now safely do something with foo and bar
});

Example 2

For example, to import all symbols into a local block, you might write:

setAttr(node,name,value)

When passing functions as values, note that they will not be directly assigned to slots on the node, but rather the default behavior will be removed and the new behavior will be added using dojo.connect(), meaning that event handler properties will be normalized and that some caveats with regards to non-standard behaviors for onsubmit apply. Namely that you should cancel form submission using dojo.stopEvent() on the passed event object instead of returning a boolean value from the handler itself.

Parameter

Type

Description

node

DOMNode | String

id or reference to the element to set the attribute on

name

String | Object

the name of the attribute to set, or a hash of key-value pairs to set.

setContentSize(node,box,computedStyle)

Sets the size of the node's contents, irrespective of margins, padding, or borders.

Parameter

Type

Description

node

DOMNode

box

Object

hash with optional "w", and "h" properties for "width", and "height" respectively. All specified properties should have numeric values in whole pixels.

computedStyle

Object

Optional

This parameter accepts computed styles object. If this parameter is omitted, the functions will call dojo/dom-style.getComputedStyle to get one. It is a better way, calling dojo/dom-style.getComputedStyle once, and then pass the reference to this computedStyle parameter. Wherever possible, reuse the returned object of dojo/dom-style.getComputedStyle().

setContext(globalObject,globalDocument)

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.

setMarginBox(node,box,computedStyle)

sets the size of the node's margin box and placement (left/top), irrespective of box model. Think of it as a passthrough to setBox that handles box-model vagaries for you.

Parameter

Type

Description

node

DOMNode

box

Object

hash with optional "l", "t", "w", and "h" properties for "left", "right", "width", and "height" respectively. All specified properties should have numeric values in whole pixels.

computedStyle

Object

Optional

This parameter accepts computed styles object. If this parameter is omitted, the functions will call dojo/dom-style.getComputedStyle to get one. It is a better way, calling dojo/dom-style.getComputedStyle once, and then pass the reference to this computedStyle parameter. Wherever possible, reuse the returned object of dojo/dom-style.getComputedStyle().

setProp(node,name,value)

When passing functions as values, note that they will not be directly assigned to slots on the node, but rather the default behavior will be removed and the new behavior will be added using dojo.connect(), meaning that event handler properties will be normalized and that some caveats with regards to non-standard behaviors for onsubmit apply. Namely that you should cancel form submission using dojo.stopEvent() on the passed event object instead of returning a boolean value from the handler itself.

Parameter

Type

Description

node

DOMNode | String

id or reference to the element to set the property on

name

String | Object

the name of the property to set, or a hash object to set multiple properties at once.

setStyle(node,name,value)

the style property to set in DOM-accessor format ("borderWidth", not "border-width") or an object with key/value pairs suitable for setting each property.

value

String

Optional

If passed, sets value on the node for style, handling cross-browser concerns. When setting a pixel value, be sure to include "px" in the value. For instance, top: "200px". Otherwise, in some cases, some browsers will not apply the style.

Returns: String | undefined

If passed, sets value on the node for style, handling cross-browser concerns. When setting a pixel value, be sure to include "px" in the value. For instance, top: "200px". Otherwise, in some cases, some browsers will not apply the style.

Examples

Example 1

Passing a node, a style property, and a value changes the current display of the node and returns the new computed value

style(node,name,value)

Accesses styles on a node. If 2 arguments are passed, acts as a getter. If 3 arguments are passed, acts as a setter.

Getting the style value uses the computed style for the node, so the value will be a calculated value, not just the immediate node.style value. Also when getting values, use specific style names, like "borderBottomWidth" instead of "border" since compound values like "border" are not necessarily reflected as expected. If you want to get node dimensions, use dojo.marginBox(), dojo.contentBox() or dojo.position().

Parameter

Type

Description

node

DOMNode | String

id or reference to node to get/set style for

name

String | Object

Optional

the style property to set in DOM-accessor format ("borderWidth", not "border-width") or an object with key/value pairs suitable for setting each property.

value

String

Optional

If passed, sets value on the node for style, handling cross-browser concerns. When setting a pixel value, be sure to include "px" in the value. For instance, top: "200px". Otherwise, in some cases, some browsers will not apply the style.

Returns: any | undefined

when used as a getter, return the computed style of the node if passing in an ID or node, or return the normalized, computed value for the property when passing in a node and a style property

Examples

Example 1

Passing only an ID or node returns the computed style object of the node:

dojo.style("thinger");

Example 2

Passing a node and a style property returns the current normalized, computed value for that property:

dojo.style("thinger", "opacity"); // 1 by default

Example 3

Passing a node, a style property, and a value changes the current display of the node and returns the new computed value

dojo.style("thinger", "opacity", 0.5); // == 0.5

Example 4

Passing a node, an object-style style property sets each of the values in turn and returns the computed style object of the node:

toJson(it,prettyPrint)

Returns a JSON serialization of an object. Note that this doesn't check for infinite recursion, so don't do that! It is recommend that you use dojo/json's stringify function for an lighter and faster implementation that matches the native JSON API and uses the native JSON serializer when available.

Parameter

Type

Description

it

Object

an object to be serialized. Objects may define their own serialization via a special "json" or "json" function property. If a specialized serializer has been defined, it will be used as a fallback. Note that in 1.6, toJson would serialize undefined, but this no longer supported since it is not supported by native JSON serializer.

prettyPrint

Boolean

Optional

if true, we indent objects and arrays to make the output prettier. The variable dojo.toJsonIndentStr is used as the indent string -- to use something other than the default (tab), change that variable before calling dojo.toJson(). Note that if native JSON support is available, it will be used for serialization, and native implementations vary on the exact spacing used in pretty printing.

when(valueOrPromise,callback,errback,progback)

Accepts promises but also transparently handles non-promises. If no callbacks are provided returns a promise, regardless of the initial value. Foreign promises are converted.

If callbacks are provided and the initial value is not a promise, the callback is executed immediately with no error handling. Returns a promise if the initial value is a promise, or the result of the callback otherwise.

Parameter

Type

Description

valueOrPromise

undefined

Either a regular value or an object with a then() method that follows the Promises/A specification.

callback

Function

Optional

Callback to be invoked when the promise is resolved, or a non-promise is received.

windowUnloaded()

signal fired by impending window destruction. You may use dojo.addOnWIndowUnload() or dojo.connect() to this method to perform page/application cleanup methods. See dojo.addOnWindowUnload for more info.

withDoc(documentObject,callback,thisObject,cbArguments)

Invoke callback with documentObject as dojo/_base/window::doc. If provided, callback will be executed in the context of object thisObject When callback() returns or throws an error, the dojo/_base/window::doc will be restored to its previous state.

Parameter

Type

Description

documentObject

DocumentElement

callback

Function

thisObject

Object

Optional

cbArguments

Array

Optional

Returns: undefined

withGlobal(globalObject,callback,thisObject,cbArguments)

Invoke callback with globalObject as dojo.global and globalObject.document as dojo.doc.

Invoke callback with globalObject as dojo.global and globalObject.document as dojo.doc. If provided, globalObject will be executed in the context of object thisObject When callback() returns or throws an error, the dojo.global and dojo.doc will be restored to its previous state.

false is default. Indicates whether the request should be a synchronous (blocking) request.

headers (Object, optional):

Additional HTTP headers to send in the request.

failOk (Boolean, optional):

false is default. Indicates whether a request should be allowed to fail (and therefore no console error message in the event of a failure)

contentType (String|Boolean):

"application/x-www-form-urlencoded" is default. Set to false to prevent a Content-Type header from being sent, or to a string to send a different Content-Type.

load:

This function will be called on a successful HTTP response code.

error:

This function will be called when the request fails due to a network or server error, the url is invalid, etc. It will also be called if the load or handle callback throws an exception, unless djConfig.debugAtAllCosts is true. This allows deployed applications to continue to run even when a logic error happens in the callback, while making it easier to troubleshoot while in debug mode.

handle:

This function will be called at the end of every request, whether or not an error occurs.

url (String):

URL to server endpoint.

content (Object, optional):

Contains properties with string values. These properties will be serialized as name1=value2 and passed in the request.

timeout (Integer, optional):

Milliseconds to wait for the response. If this time passes, the then error callbacks are called.

form (DOMNode, optional):

DOM node for a form. Used to extract the form values and send to the server.

preventCache (Boolean, optional):

Default is false. If true, then a "dojo.preventCache" parameter is sent in the request with a value that changes with each request (timestamp). Useful only with GET-type requests.

rawBody (String, optional):

Sets the raw body for an HTTP request. If this is used, then the content property is ignored. This is mostly useful for HTTP methods that have a body to their requests, like PUT or POST. This property can be used instead of postData and putData for dojo/_base/xhr.rawXhrPost and dojo/_base/xhr.rawXhrPut respectively.

ioPublish (Boolean, optional):

Set this explicitly to false to prevent publishing of topics related to IO operations. Otherwise, if djConfig.ioPublish is set to true, topics will be published via dojo/topic.publish() for different phases of an IO operation. See dojo/main.__IoPublish for a list of topics that are published.

false is default. Indicates whether the request should be a synchronous (blocking) request.

headers (Object, optional):

Additional HTTP headers to send in the request.

failOk (Boolean, optional):

false is default. Indicates whether a request should be allowed to fail (and therefore no console error message in the event of a failure)

contentType (String|Boolean):

"application/x-www-form-urlencoded" is default. Set to false to prevent a Content-Type header from being sent, or to a string to send a different Content-Type.

load:

This function will be called on a successful HTTP response code.

error:

This function will be called when the request fails due to a network or server error, the url is invalid, etc. It will also be called if the load or handle callback throws an exception, unless djConfig.debugAtAllCosts is true. This allows deployed applications to continue to run even when a logic error happens in the callback, while making it easier to troubleshoot while in debug mode.

handle:

This function will be called at the end of every request, whether or not an error occurs.

url (String):

URL to server endpoint.

content (Object, optional):

Contains properties with string values. These properties will be serialized as name1=value2 and passed in the request.

timeout (Integer, optional):

Milliseconds to wait for the response. If this time passes, the then error callbacks are called.

form (DOMNode, optional):

DOM node for a form. Used to extract the form values and send to the server.

preventCache (Boolean, optional):

Default is false. If true, then a "dojo.preventCache" parameter is sent in the request with a value that changes with each request (timestamp). Useful only with GET-type requests.

rawBody (String, optional):

Sets the raw body for an HTTP request. If this is used, then the content property is ignored. This is mostly useful for HTTP methods that have a body to their requests, like PUT or POST. This property can be used instead of postData and putData for dojo/_base/xhr.rawXhrPost and dojo/_base/xhr.rawXhrPut respectively.

ioPublish (Boolean, optional):

Set this explicitly to false to prevent publishing of topics related to IO operations. Otherwise, if djConfig.ioPublish is set to true, topics will be published via dojo/topic.publish() for different phases of an IO operation. See dojo/main.__IoPublish for a list of topics that are published.

false is default. Indicates whether the request should be a synchronous (blocking) request.

headers (Object, optional):

Additional HTTP headers to send in the request.

failOk (Boolean, optional):

false is default. Indicates whether a request should be allowed to fail (and therefore no console error message in the event of a failure)

contentType (String|Boolean):

"application/x-www-form-urlencoded" is default. Set to false to prevent a Content-Type header from being sent, or to a string to send a different Content-Type.

load:

This function will be called on a successful HTTP response code.

error:

This function will be called when the request fails due to a network or server error, the url is invalid, etc. It will also be called if the load or handle callback throws an exception, unless djConfig.debugAtAllCosts is true. This allows deployed applications to continue to run even when a logic error happens in the callback, while making it easier to troubleshoot while in debug mode.

handle:

This function will be called at the end of every request, whether or not an error occurs.

url (String):

URL to server endpoint.

content (Object, optional):

Contains properties with string values. These properties will be serialized as name1=value2 and passed in the request.

timeout (Integer, optional):

Milliseconds to wait for the response. If this time passes, the then error callbacks are called.

form (DOMNode, optional):

DOM node for a form. Used to extract the form values and send to the server.

preventCache (Boolean, optional):

Default is false. If true, then a "dojo.preventCache" parameter is sent in the request with a value that changes with each request (timestamp). Useful only with GET-type requests.

rawBody (String, optional):

Sets the raw body for an HTTP request. If this is used, then the content property is ignored. This is mostly useful for HTTP methods that have a body to their requests, like PUT or POST. This property can be used instead of postData and putData for dojo/_base/xhr.rawXhrPost and dojo/_base/xhr.rawXhrPut respectively.

ioPublish (Boolean, optional):

Set this explicitly to false to prevent publishing of topics related to IO operations. Otherwise, if djConfig.ioPublish is set to true, topics will be published via dojo/topic.publish() for different phases of an IO operation. See dojo/main.__IoPublish for a list of topics that are published.

false is default. Indicates whether the request should be a synchronous (blocking) request.

headers (Object, optional):

Additional HTTP headers to send in the request.

failOk (Boolean, optional):

false is default. Indicates whether a request should be allowed to fail (and therefore no console error message in the event of a failure)

contentType (String|Boolean):

"application/x-www-form-urlencoded" is default. Set to false to prevent a Content-Type header from being sent, or to a string to send a different Content-Type.

load:

This function will be called on a successful HTTP response code.

error:

This function will be called when the request fails due to a network or server error, the url is invalid, etc. It will also be called if the load or handle callback throws an exception, unless djConfig.debugAtAllCosts is true. This allows deployed applications to continue to run even when a logic error happens in the callback, while making it easier to troubleshoot while in debug mode.

handle:

This function will be called at the end of every request, whether or not an error occurs.

url (String):

URL to server endpoint.

content (Object, optional):

Contains properties with string values. These properties will be serialized as name1=value2 and passed in the request.

timeout (Integer, optional):

Milliseconds to wait for the response. If this time passes, the then error callbacks are called.

form (DOMNode, optional):

DOM node for a form. Used to extract the form values and send to the server.

preventCache (Boolean, optional):

Default is false. If true, then a "dojo.preventCache" parameter is sent in the request with a value that changes with each request (timestamp). Useful only with GET-type requests.

rawBody (String, optional):

Sets the raw body for an HTTP request. If this is used, then the content property is ignored. This is mostly useful for HTTP methods that have a body to their requests, like PUT or POST. This property can be used instead of postData and putData for dojo/_base/xhr.rawXhrPost and dojo/_base/xhr.rawXhrPut respectively.

ioPublish (Boolean, optional):

Set this explicitly to false to prevent publishing of topics related to IO operations. Otherwise, if djConfig.ioPublish is set to true, topics will be published via dojo/topic.publish() for different phases of an IO operation. See dojo/main.__IoPublish for a list of topics that are published.