|
|
|
__backArgs(
kwArgs
) :
void
Parameter |
Type |
Usage |
Description |
kwArgs |
|
required |
|
|
|
|
|
__cookieProps(
) :
void
|
|
|
|
__FadeArgs(
node
: DOMNode|String
duration
: Integer
easing
: Function
) :
void
Parameter |
Type |
Usage |
Description |
node |
DOMNode|String |
required |
The node referenced in the animation |
duration |
Integer |
optional |
Duration of the animation in milliseconds. |
easing |
Function |
optional |
An easing function. |
|
|
|
|
__IoArgs(
) :
void
|
|
|
|
__IoCallbackArgs(
args
: Object
xhr
: XMLHttpRequest
url
: String
query
: String
handleAs
: String
id
: String
canDelete
: Boolean
json
: Object
) :
void
Parameter |
Type |
Usage |
Description |
args |
Object |
required |
the original object argument to the IO call. |
xhr |
XMLHttpRequest |
required |
For XMLHttpRequest calls only, the
XMLHttpRequest object that was used for the
request. |
url |
String |
required |
The final URL used for the call. Many times it
will be different than the original args.url
value. |
query |
String |
required |
For non-GET requests, the
name1=value1&name2=value2 parameters sent up in
the request. |
handleAs |
String |
required |
The final indicator on how the response will be
handled. |
id |
String |
required |
For dojo.io.script calls only, the internal
script ID used for the request. |
canDelete |
Boolean |
required |
For dojo.io.script calls only, indicates
whether the script tag that represents the
request can be deleted after callbacks have
been called. Used internally to know when
cleanup can happen on JSONP-type requests. |
json |
Object |
required |
|
|
|
|
|
__IoPublish(
) :
void
This is a list of IO topics that can be published
if djConfig.ioPublish is set to true. IO topics can be
published for any Input/Output, network operation. So,
dojo.xhr, dojo.io.script and dojo.io.iframe can all
trigger these topics to be published.
|
|
|
|
_abs(
) :
void
|
|
|
|
_callLoaded(
) :
void
|
|
|
|
_connect(
obj
event
context
method
dontFix
) :
void
Parameter |
Type |
Usage |
Description |
obj |
|
required |
|
event |
|
required |
|
context |
|
required |
|
method |
|
required |
|
dontFix |
|
required |
|
|
|
|
|
_defaultEasing(
n
: Decimal
) :
void
The default easing function for dojo.Animation(s)
Parameter |
Type |
Usage |
Description |
n |
Decimal |
optional |
|
|
|
|
|
_destroyElement(
node
) :
void
Existing alias for dojo.destroy . Deprecated, will be removed
in 2.0
Parameter |
Type |
Usage |
Description |
node |
|
required |
|
|
|
|
|
_disconnect(
obj
event
handle
listener
) :
void
Parameter |
Type |
Usage |
Description |
obj |
|
required |
|
event |
|
required |
|
handle |
|
required |
|
listener |
|
required |
|
|
|
|
|
_docScroll(
) :
void
|
|
|
|
_escapeString(
str
: String
) :
void
Adds escape sequences for non-visual characters, double quote and
backslash and surrounds with double quotes to form a valid string
literal.
Parameter |
Type |
Usage |
Description |
str |
String |
required |
|
|
|
|
|
_fade(
args
: Object
) :
void
Returns an animation that will fade the node defined by
args.node from the start to end values passed (args.start
args.end) (end is mandatory, start is optional)
Parameter |
Type |
Usage |
Description |
args |
Object |
required |
|
|
|
|
|
_filterQueryResult(
nodeList
simpleFilter
) :
void
Parameter |
Type |
Usage |
Description |
nodeList |
|
required |
|
simpleFilter |
|
required |
|
|
|
|
|
_fixIeBiDiScrollLeft(
scrollLeft
: Integer
) :
void
|
|
|
|
_getBorderBox(
node
computedStyle
) :
void
Parameter |
Type |
Usage |
Description |
node |
|
required |
|
computedStyle |
|
required |
|
|
|
|
|
_getBorderExtents(
n
: DomNode
computedStyle
: Object
) :
void
returns an object with properties useful for noting the border
dimensions.
* l/t = the sum of left/top 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 |
Usage |
Description |
n |
DomNode |
required |
|
computedStyle |
Object |
required |
|
|
|
|
|
_getContentBox(
node
computedStyle
) :
void
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 |
Usage |
Description |
node |
|
required |
|
computedStyle |
|
required |
|
|
|
|
|
_getIeDispatcher(
) :
void
|
|
|
|
_getIeDocumentElementOffset(
) :
void
returns the offset in x and y from the document body to the
visual edge of the page
|
|
|
|
_getMarginBox(
node
: DomNode
computedStyle
: Object
) :
void
returns an object that encodes the width, height, left and top
positions of the node's margin box.
Parameter |
Type |
Usage |
Description |
node |
DomNode |
required |
|
computedStyle |
Object |
required |
|
|
|
|
|
_getMarginExtents(
n
computedStyle
) :
void
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 |
Usage |
Description |
n |
|
required |
|
computedStyle |
|
required |
|
|
|
|
|
_getModulePrefix(
module
: String
) :
void
gets the prefix associated with module
Parameter |
Type |
Usage |
Description |
module |
String |
required |
|
|
|
|
|
_getModuleSymbols(
modulename
: String
) :
void
Converts a module name in dotted JS notation to an array
representing the path in the source tree
Parameter |
Type |
Usage |
Description |
modulename |
String |
required |
|
|
|
|
|
_getOpacity(
node
: DomNode
) :
void
Returns the current opacity of the passed node as a
floating-point value between 0 and 1.
Parameter |
Type |
Usage |
Description |
node |
DomNode |
required |
a reference to a DOM node. Does NOT support taking an
ID string for speed reasons. |
|
|
|
|
_getPadBorderExtents(
n
: DomNode
computedStyle
: Object
) :
void
Returns object with properties useful for box fitting with
regards to padding.
* l/t = the sum of left/top padding and left/top border (respectively)
* w = the sum of the left and right padding and border
* h = the sum of the top and bottom padding and 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 |
Usage |
Description |
n |
DomNode |
required |
|
computedStyle |
Object |
required |
|
|
|
|
|
_getPadExtents(
n
: DomNode
computedStyle
: Object
) :
void
Returns object with special values specifically useful for node
fitting.
Parameter |
Type |
Usage |
Description |
n |
DomNode |
required |
|
computedStyle |
Object |
required |
|
|
|
|
|
_getProp(
parts
: Array
create
: Boolean
context
: Object
) :
void
Parameter |
Type |
Usage |
Description |
parts |
Array |
required |
|
create |
Boolean |
required |
|
context |
Object |
required |
|
|
|
|
|
_getText(
uri
: URI
fail_ok
: Boolean
) :
void
Read the contents of the specified uri and return those contents.
Parameter |
Type |
Usage |
Description |
uri |
URI |
required |
A relative or absolute uri. |
fail_ok |
Boolean |
required |
Default false. If fail_ok and loading fails, return null
instead of throwing. |
|
|
|
|
_hitchArgs(
scope
method
: ,
) :
void
Parameter |
Type |
Usage |
Description |
scope |
|
required |
|
method |
, |
one-or-more |
|
|
|
|
|
_ieDispatcher(
args
sender
) :
void
Parameter |
Type |
Usage |
Description |
args |
|
required |
|
sender |
|
required |
|
|
|
|
|
_inContext(
g
d
f
) :
void
Parameter |
Type |
Usage |
Description |
g |
|
required |
|
d |
|
required |
|
f |
|
required |
|
|
|
|
|
_ioAddQueryToUrl(
ioArgs
: dojo.__IoCallbackArgs
) :
void
Adds query params discovered by the io deferred construction to the URL.
Only use this for operations which are fundamentally GET-type operations.
Parameter |
Type |
Usage |
Description |
ioArgs |
dojo.__IoCallbackArgs |
required |
|
|
|
|
|
_ioCancelAll(
) :
void
Cancels all pending IO requests, regardless of IO type
(xhr, script, iframe).
|
|
|
|
_ioNotifyStart(
dfd
: Deferred
) :
void
If dojo.publish is available, publish topics
about the start of a request queue and/or the
the beginning of request.
Used by IO transports. An IO transport should
call this method before making the network connection.
Parameter |
Type |
Usage |
Description |
dfd |
Deferred |
required |
|
|
|
|
|
_ioSetArgs(
args
: dojo.__IoArgs
canceller
: Function
okHandler
: Function
errHandler
: Function
) :
void
sets up the Deferred and ioArgs property on the Deferred so it
can be used in an io call.
Parameter |
Type |
Usage |
Description |
args |
dojo.__IoArgs |
required |
The args object passed into the public io call. Recognized properties on |
canceller |
Function |
required |
The canceller function used for the Deferred object. The function
will receive one argument, the Deferred object that is related to the
canceller. |
okHandler |
Function |
required |
The first OK callback to be registered with Deferred. It has the opportunity
to transform the OK response. It will receive one argument -- the Deferred
object returned from this function. |
errHandler |
Function |
required |
The first error callback to be registered with Deferred. It has the opportunity |
|
|
|
|
_ioWatch(
dfd
: Deferred
validCheck
: Function
ioCheck
: Function
resHandle
: Function
) :
void
Watches the io request represented by dfd to see if it completes.
Parameter |
Type |
Usage |
Description |
dfd |
Deferred |
required |
The Deferred object to watch. |
validCheck |
Function |
required |
Function used to check if the IO request is still valid. Gets the dfd
object as its only argument. |
ioCheck |
Function |
required |
Function used to check if basic IO call worked. Gets the dfd
object as its only argument. |
resHandle |
Function |
required |
Function used to process response. Gets the dfd
object as its only argument. |
|
|
|
|
_isBodyLtr(
) :
void
|
|
|
|
_isButtonTag(
node
: DomNode
) :
void
|
|
|
|
_isDocumentOk(
http
) :
void
Parameter |
Type |
Usage |
Description |
http |
|
required |
|
|
|
|
|
_isLocalUrl(
uri
: String
) :
void
determines if URI is local or not.
Parameter |
Type |
Usage |
Description |
uri |
String |
required |
|
|
|
|
|
_Line(
start
: int
end
: int
) :
void
dojo._Line is the object used to generate values from a start value
to an end value
Parameter |
Type |
Usage |
Description |
start |
int |
required |
Beginning value for range |
end |
int |
required |
Ending value for range |
|
|
|
|
_loadInit(
e
) :
void
Parameter |
Type |
Usage |
Description |
e |
|
required |
|
|
|
|
|
_loadModule(
) :
void
|
|
|
|
_loadPath(
relpath
: String
module
: String
cb
: Function
) :
void
Internal xd loader function. Overrides loadPath() from loader.js.
xd loading requires slightly different behavior from loadPath().
Loads and interprets the script located at relpath, which is
relative to the script root directory. If the script is found but
its interpretation causes a runtime exception, that exception is
not caught by us, so the caller will see it. We return a true
value if and only if the script is found.
Parameter |
Type |
Usage |
Description |
relpath |
String |
required |
A relative path to a script (no leading '/', and typically ending
in '.js'). |
module |
String |
optional |
A module whose existance to check for after loading a path. Can be
used to determine success or failure of the load. |
cb |
Function |
optional |
a callback function to pass the result of evaluating the script |
|
|
|
|
_loadUri(
uri
: String
cb
: Function
currentIsXDomain
: boolean
module
: String
) :
void
Internal xd loader function. Overrides loadUri() from loader.js.
xd loading requires slightly different behavior from loadPath().
Wanted to override getText(), but it is used by
the widget code in too many, synchronous ways right now.
Parameter |
Type |
Usage |
Description |
uri |
String |
required |
a uri which points at the script to be loaded |
cb |
Function |
required |
a callback function to process the result of evaluating the script
as an expression, typically used by the resource bundle loader to
load JSON-style resources |
currentIsXDomain |
boolean |
required |
|
module |
String |
required |
|
|
|
|
|
_loadUriAndCheck(
uri
: String
moduleName
: String
cb
: Function
) :
void
calls loadUri then findModule and returns true if both succeed
Parameter |
Type |
Usage |
Description |
uri |
String |
required |
|
moduleName |
String |
required |
|
cb |
Function |
optional |
|
|
|
|
|
_mixin(
target
: Object
source
: Object
) :
void
Adds all properties and methods of source to target. This addition
is "prototype extension safe", so that instances of objects
will not pass along prototype defaults.
Parameter |
Type |
Usage |
Description |
target |
Object |
required |
|
source |
Object |
required |
|
|
|
|
|
_moduleHasPrefix(
module
: String
) :
void
checks to see if module has been established
Parameter |
Type |
Usage |
Description |
module |
String |
required |
|
|
|
|
|
_modulesLoaded(
) :
void
|
|
|
|
_onto(
arr
obj
fn
) :
void
Parameter |
Type |
Usage |
Description |
arr |
|
required |
|
obj |
|
required |
|
fn |
|
required |
|
|
|
|
|
_setBox(
node
: DomNode
l
: Number
t
: Number
w
: Number
h
: Number
u
: String
) :
void
sets width/height/left/top in the current (native) box-model
dimentions. Uses the unit passed in u.
Parameter |
Type |
Usage |
Description |
node |
DomNode |
required |
DOM Node reference. Id string not supported for performance
reasons. |
l |
Number |
optional |
left offset from parent. |
t |
Number |
optional |
top offset from parent. |
w |
Number |
optional |
width in current box model. |
h |
Number |
optional |
width in current box model. |
u |
String |
optional |
unit measure to use for other measures. Defaults to "px". |
|
|
|
|
_setContentSize(
node
: DomNode
widthPx
: Number
heightPx
: Number
computedStyle
: Object
) :
void
Sets the size of the node's contents, irrespective of margins,
padding, or borders.
Parameter |
Type |
Usage |
Description |
node |
DomNode |
required |
|
widthPx |
Number |
required |
|
heightPx |
Number |
required |
|
computedStyle |
Object |
required |
|
|
|
|
|
_setMarginBox(
node
: DomNode
leftPx
: Number
topPx
: Number
widthPx
: Number
heightPx
: Number
computedStyle
: Object
) :
void
sets the size of the node's margin box and placement
(left/top), irrespective of box model. Think of it as a
passthrough to dojo._setBox that handles box-model vagaries for
you.
Parameter |
Type |
Usage |
Description |
node |
DomNode |
required |
|
leftPx |
Number |
optional |
|
topPx |
Number |
optional |
|
widthPx |
Number |
optional |
|
heightPx |
Number |
optional |
|
computedStyle |
Object |
required |
|
|
|
|
|
_setOpacity(
node
: DOMNode
opacity
: Number
) :
void
set the opacity of the passed node portably. Returns the
new opacity of the node.
Parameter |
Type |
Usage |
Description |
node |
DOMNode |
required |
a reference to a DOM node. Does NOT support taking an
ID string for performance reasons. |
opacity |
Number |
required |
A Number between 0 and 1. 0 specifies transparent. |
|
|
|
|
_spidermonkeyCurrentFile(
depth
) :
void
Parameter |
Type |
Usage |
Description |
depth |
|
required |
|
|
|
|
|
_toArray(
obj
: Object
offset
: Number
startWith
: Array
) :
void
Converts an array-like object (i.e. arguments, DOMCollection) to an
array. Returns a new Array with the elements of obj.
Parameter |
Type |
Usage |
Description |
obj |
Object |
required |
the object to "arrayify". We expect the object to have, at a
minimum, a length property which corresponds to integer-indexed
properties. |
offset |
Number |
optional |
the location in obj to start iterating from. Defaults to 0.
Optional. |
startWith |
Array |
optional |
An array to pack with the properties of obj. If provided,
properties in obj are appended at the end of startWith and
startWith is the returned array. |
|
|
|
|
_toDom(
frag
: String
doc
: DocumentNode
) :
void
converts HTML string into DOM nodes.
Parameter |
Type |
Usage |
Description |
frag |
String |
required |
the HTML fragment |
doc |
DocumentNode |
optional |
optional document to use when creating DOM nodes, defaults to
dojo.doc if not specified. |
Examples
|
|
|
|
_toPixelValue(
element
value
avalue
) :
void
Parameter |
Type |
Usage |
Description |
element |
|
required |
|
value |
|
required |
|
avalue |
|
required |
|
|
|
|
|
_Url(
) :
void
Constructor to create an object representing a URL.
It is marked as private, since we might consider removing
or simplifying it.
Each argument is evaluated in order relative to the next until
a canonical uri is produced. To get an absolute Uri relative to
|
|
|
|
_usesBorderBox(
node
: DomNode
) :
void
True if the node uses border-box layout.
Parameter |
Type |
Usage |
Description |
node |
DomNode |
required |
|
|
|
|
|
_xdClearInterval(
) :
void
Internal xd loader function.
Clears the interval timer used to check on the
status of in-flight xd module resource requests.
|
|
|
|
_xdCreateResource(
contents
: String
resourceName
: String
resourcePath
: String
) :
void
Internal xd loader function. Creates an xd module source given an
non-xd module contents.
Parameter |
Type |
Usage |
Description |
contents |
String |
required |
|
resourceName |
String |
required |
|
resourcePath |
String |
required |
|
|
|
|
|
_xdDebugFileLoaded(
resourceName
) :
void
Parameter |
Type |
Usage |
Description |
resourceName |
|
required |
|
|
|
|
|
_xdEvalReqs(
reqChain
: Array
) :
void
Internal xd loader function.
Does a depth first, breadth second search and eval of required modules.
Parameter |
Type |
Usage |
Description |
reqChain |
Array |
required |
|
|
|
|
|
_xdExtractLoadInits(
fileContents
: String
) :
void
|
|
|
|
_xdInitExtraLocales(
) :
void
|
|
|
|
_xdIsXDomainPath(
relpath
: string
) :
void
Figure out whether the path is local or x-domain
If there is a colon before the first / then, we have a URL with a protocol.
Parameter |
Type |
Usage |
Description |
relpath |
string |
required |
|
|
|
|
|
_xdLoadFlattenedBundle(
moduleName
: String
bundleName
: String
locale
: String
bundleData
: Object
) :
void
Internal xd loader function. Used when loading
a flattened localized bundle via a script tag.
Parameter |
Type |
Usage |
Description |
moduleName |
String |
required |
|
bundleName |
String |
required |
|
locale |
String |
optional |
|
bundleData |
Object |
required |
|
|
|
|
|
_xdNotifyLoaded(
) :
void
|
|
|
|
_xdReset(
) :
void
Internal xd loader function. Resets the xd state.
|
|
|
|
_xdResourceLoaded(
res
: Object
) :
void
Internal xd loader function. Called by an xd module resource when
it has been loaded via a script tag.
Parameter |
Type |
Usage |
Description |
res |
Object |
required |
|
|
|
|
|
_xdUnpackDependency(
dep
: Array
) :
void
Internal xd loader function. Determines what to do with a dependency
that was listed in an xd version of a module contents.
Parameter |
Type |
Usage |
Description |
dep |
Array |
required |
|
|
|
|
|
_xdWalkReqs(
) :
void
Internal xd loader function.
Walks the requires and evaluates module resource contents in
the right order.
|
|
|
|
_xdWatchInFlight(
) :
void
Internal xd loader function.
Monitors in-flight requests for xd module resources.
|
|
|
|
_xhrObj(
) :
void
does the work of portably generating a new XMLHTTPRequest object.
|
|
|
|
add(
behaviorObj
: Object
) :
void
Add the specified behavior to the list of behaviors, ignoring existing
matches.
Add the specified behavior to the list of behaviors which will
be applied the next time apply() is called. Calls to add() for
an already existing behavior do not replace the previous rules,
but are instead additive. New nodes which match the rule will
have all add()-ed behaviors applied to them when matched.
The "found" method is a generalized handler that's called as soon
as the node matches the selector. Rules for values that follow also
apply to the "found" key.
The "on*" handlers are attached with `dojo.connect()`, using the
matching node
If the value corresponding to the ID key is a function and not a
list, it's treated as though it was the value of "found".
dojo.behavior.add() can be called any number of times before
the DOM is ready. `dojo.behavior.apply()` is called automatically
by `dojo.addOnLoad`, though can be called to re-apply previously added
behaviors anytime the DOM changes.
There are a variety of formats permitted in the behaviorObject
Parameter |
Type |
Usage |
Description |
behaviorObj |
Object |
required |
|
Examples
|
|
|
|
addClass(
node
: DomNode|String
classStr
: String|Array
) :
void
Adds the specified classes to the end of the class list on the
passed node. Will not re-apply duplicate classes.
Parameter |
Type |
Usage |
Description |
node |
DomNode|String |
required |
String ID or DomNode reference to add a class string too |
classStr |
String|Array |
required |
A String class name to add, or several space-separated class names,
or an array of class names. |
Examples
|
|
|
|
addOnLoad(
obj
: Object
functionName
: String|Function
) :
void
Registers a function to be triggered after the DOM and dojo.require() calls
have finished loading.
Registers a function to be triggered after the DOM has finished
loading and `dojo.require` modules have loaded. Widgets declared in markup
have been instantiated if `djConfig.parseOnLoad` is true when this fires.
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, though including css resouces BEFORE any script elements
is highly recommended).
Parameter |
Type |
Usage |
Description |
obj |
Object |
required |
|
functionName |
String|Function |
optional |
|
Examples
|
|
|
|
addOnUnload(
obj
: Object|Function
functionName
: String|Function
) :
void
registers a function to be triggered when the page unloads.
The first time that addOnUnload is called Dojo will
register a page listener to trigger your unload handler
with.
In a browser enviroment, 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
Parameter |
Type |
Usage |
Description |
obj |
Object|Function |
optional |
|
functionName |
String|Function |
optional |
|
Examples
|
|
|
|
addOnWindowUnload(
obj
: Object|Function
functionName
: String|Function
) :
void
registers a function to be triggered when window.onunload fires.
Be careful trying to modify the DOM or access JavaScript properties
The first time that addOnWindowUnload is called Dojo
will register a page listener to trigger your unload
handler with. Note that registering these handlers may
destory "fastback" page caching in browsers that support
it. Be careful trying to modify the DOM or access
Parameter |
Type |
Usage |
Description |
obj |
Object|Function |
optional |
|
functionName |
String|Function |
optional |
|
Examples
|
|
|
|
anim(
node
: DOMNode|String
properties
: Object
duration
: Integer
easing
: Function
onEnd
: Function
delay
: Integer
) :
void
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.
`dojo.anim` is a simpler (but somewhat less powerful) version
of `dojo.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 `dojo.Animation` object returned from `dojo.anim` will be
already playing when it is returned from this function, so
calling play() on it again is (usually) a no-op.
Parameter |
Type |
Usage |
Description |
node |
DOMNode|String |
required |
a DOM node or the id of a node to animate CSS properties on |
properties |
Object |
required |
|
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. |
Examples
|
|
|
|
animateProperty(
args
: dojo.__AnimArgs
) :
void
Returns an animation that will transition the properties of
node defined in args depending how they are defined in
args.properties
`dojo.animateProperty` is the foundation of most `dojo.fx`
animations. It takes an object of "properties" corresponding to
style properties, and animates them in parallel over a set
duration.
Parameter |
Type |
Usage |
Description |
args |
dojo.__AnimArgs |
required |
|
Examples
|
|
|
|
apply(
) :
void
Applies all currently registered behaviors to the document.
Applies all currently registered behaviors to the document,
taking care to ensure that only incremental updates are made
since the last time add() or apply() were called.
If new matching nodes have been added, all rules in a behavior will be
applied to that node. For previously matched nodes, only
behaviors which have been added since the last call to apply()
will be added to the nodes.
apply() is called once automatically by `dojo.addOnLoad`, so
registering behaviors with `dojo.behavior.add` before the DOM is
ready is acceptable, provided the dojo.behavior module is ready.
Calling appy() manually after manipulating the DOM is required
to rescan the DOM and apply newly .add()ed behaviors, or to match
nodes that match existing behaviors when those nodes are added to
the DOM.
|
|
|
|
attr(
node
: DomNode|String
name
: String|Object
value
: String
) :
void
Gets or sets an attribute on an HTML element.
Handles normalized getting and setting of attributes on DOM
Nodes. If 2 arguments are passed, and a the second argumnt 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 |
Usage |
Description |
node |
DomNode|String |
required |
id or reference to the element to get or set the attribute on |
name |
String|Object |
required |
the name of the attribute to get or set. |
value |
String |
optional |
The value to set for the attribute |
Examples
|
|
|
|
behavior(
) :
void
Utility for unobtrusive/progressive event binding, DOM traversal,
and manipulation.
A very simple, lightweight mechanism for applying code to
existing documents, based around `dojo.query` (CSS3 selectors) for node selection,
|
|
|
|
blendColors(
start
: dojo.Color
end
: dojo.Color
weight
: Number
obj
: dojo.Color
) :
void
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
Parameter |
Type |
Usage |
Description |
start |
dojo.Color |
required |
|
end |
dojo.Color |
required |
|
weight |
Number |
required |
|
obj |
dojo.Color |
optional |
|
|
|
|
|
body(
) :
void
Return the body element of the document
return the body object associated with dojo.doc
Examples
|
|
|
|
byId(
id
: String|DOMNode
doc
: Document
) :
void
Returns DOM node with matching id attribute or null
if not found. If id is a DomNode, this function is a no-op.
Parameter |
Type |
Usage |
Description |
id |
String|DOMNode |
required |
A string to match an HTML id attribute or a reference to a DOM Node |
doc |
Document |
required |
Document to work in. Defaults to the current value of
dojo.doc. Can be used to retrieve
node references from other documents. |
Examples
|
|
|
|
cache(
module
: String||Object
url
: String
value
: String||Object
) :
void
A getter and setter for storing the string content associated with the
module and url arguments.
module and url are used to call `dojo.moduleUrl()` to generate a module URL.
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 |
Usage |
Description |
module |
String||Object |
required |
If a String, the module name to use for the base part of the URL, similar to module argument
to dojo.moduleUrl . If an Object, something that has a .toString() method that
generates a valid path for the cache item. For example, a dojo._Url object. |
url |
String |
required |
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. |
Examples
|
|
|
|
clone(
o
: anything
) :
void
Clones objects (including DOM nodes) and all children.
Parameter |
Type |
Usage |
Description |
o |
anything |
required |
|
|
|
|
|
colorFromArray(
a
: Array
obj
: dojo.Color
) :
void
Builds a dojo.Color from a 3 or 4 element array, mapping each
element in sequence to the rgb(a) values of the color.
Parameter |
Type |
Usage |
Description |
a |
Array |
required |
|
obj |
dojo.Color |
optional |
|
Examples
|
|
|
|
colorFromHex(
color
: String
obj
: dojo.Color
) :
void
Converts a hex string with a '#' prefix to a color object.
Supports 12-bit #rgb shorthand. Optionally accepts a
dojo.Color object to update with the parsed value.
Parameter |
Type |
Usage |
Description |
color |
String |
required |
|
obj |
dojo.Color |
optional |
|
Examples
|
|
|
|
colorFromRgb(
color
: String
obj
: dojo.Color
) :
void
get rgb(a) array from css-style color declarations
Parameter |
Type |
Usage |
Description |
color |
String |
required |
|
obj |
dojo.Color |
optional |
|
|
|
|
|
colorFromString(
str
: String
obj
: dojo.Color
) :
void
Parses str for a color value. Accepts hex, rgb, and rgba
style color values.
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)"
Parameter |
Type |
Usage |
Description |
str |
String |
required |
|
obj |
dojo.Color |
optional |
|
|
|
|
|
connect(
obj
: Object|null
event
: String
context
: Object|null
method
: String|Function
dontFix
: Boolean
) :
void
dojo.connect is the core 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 orginal
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, `dojo.global` is assumed, meaning that connections
to global methods are supported but also that you may inadvertantly
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 deails.
The return value is a handle that is needed to
remove this connection with `dojo.disconnect`.
Parameter |
Type |
Usage |
Description |
obj |
Object|null |
required |
The source object for the event function.
Defaults to dojo.global if null.
If obj is a DOM node, the connection is delegated
to the DOM event manager (unless dontFix is true). |
event |
String |
required |
name of the event function in obj.
I.e. identifies a property obj[event] . |
context |
Object|null |
required |
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,
dojo.global is used. |
method |
String|Function |
required |
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. |
Examples
|
|
|
|
connectPublisher(
topic
: String
obj
: Object|null
event
: String
) :
void
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.
Parameter |
Type |
Usage |
Description |
topic |
String |
required |
The name of the topic to publish. |
obj |
Object|null |
required |
The source object for the event function. Defaults to dojo.global
if null. |
event |
String |
required |
The name of the event function in obj.
I.e. identifies a property obj[event]. |
Examples
|
|
|
|
contentBox(
node
: DomNode|String
box
: Object
) :
void
Getter/setter for the content-box of node.
Returns an object in the expected format of box (regardless if box is passed).
Parameter |
Type |
Usage |
Description |
node |
DomNode|String |
required |
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. All properties are optional if passed. |
|
|
|
|
cookie(
name
: String
value
: String
props
: dojo.__cookieProps
) :
void
Get or set a cookie.
If one argument is passed, returns the value of the cookie
For two or more arguments, acts as a setter.
Parameter |
Type |
Usage |
Description |
name |
String |
required |
Name of the cookie |
value |
String |
optional |
Value for the cookie |
props |
dojo.__cookieProps |
optional |
Properties for the cookie |
Examples
|
|
|
|
coords(
node
: DomNode|String
includeScroll
: Boolean
) :
void
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().
Parameter |
Type |
Usage |
Description |
node |
DomNode|String |
required |
|
includeScroll |
Boolean |
optional |
|
|
|
|
|
create(
tag
: String|DomNode
attrs
: Object
refNode
: String|DomNode
pos
: String
) :
void
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.attr`.
See `dojo.attr` 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 |
Usage |
Description |
tag |
String|DomNode |
required |
|
attrs |
Object |
required |
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. |
refNode |
String|DomNode |
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. |
Examples
|
|
|
|
declare(
className
: String:
superclass
: Function|Function[]:
props
: Object:
) :
void
Create a feature-rich constructor from compact notation.
Create a constructor using a compact notation for inheritance and
prototype extension.
Mixin ancestors provide a type of multiple inheritance.
Parameter |
Type |
Usage |
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[]: |
required |
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: |
required |
An object whose properties are copied to the created prototype.
Add an instance-initialization function by making it a property
named "constructor". |
Examples
|
|
|
|
delegate(
obj
: The
props
: an
) :
void
Returns a new object which "looks" to obj for properties which it
does not have a value for. Optionally takes a bag of properties to
seed the returned object with initially.
This is a small implementaton of the Boodman/Crockford delegation
pattern in JavaScript. An intermediate object constructor mediates
the prototype chain for the returned object, using it to delegate
down to obj for property lookup when object-local lookup fails.
This can be thought of similarly to ES4's "wrap", save that it does
not act on types but rather on pure objects.
Parameter |
Type |
Usage |
Description |
obj |
The |
required |
object to delegate to for properties not found directly on the
return object or in props. |
props |
an |
required |
object containing properties to assign to the returned object |
Examples
|
|
|
|
deprecated(
behaviour
: String
extra
: String
removal
: String
) :
void
Log a debug message to indicate that a behavior has been
deprecated.
Parameter |
Type |
Usage |
Description |
behaviour |
String |
required |
The API or behavior being deprecated. Usually in the form
of "myApp.someFunction()". |
extra |
String |
optional |
Text to append to the message. |
removal |
String |
optional |
Text to indicate when in the future the behavior will be removed. |
Examples
|
|
|
|
destroy(
node
: String|DomNode
) :
void
Removes a node from its parent, clobbering it and all of its
children.
Removes a node from its parent, clobbering it and all of its
children. Function only works with DomNodes, and returns nothing.
Parameter |
Type |
Usage |
Description |
node |
String|DomNode |
required |
A String ID or DomNode reference of the element to be destroyed |
Examples
|
|
|
|
disconnect(
handle
: Handle
) :
void
Remove a link created by dojo.connect.
Removes the connection between event and the method referenced by handle.
Parameter |
Type |
Usage |
Description |
handle |
Handle |
required |
the return value of the dojo.connect call that created the connection. |
|
|
|
|
empty(
node
: DOMNode|String
) :
void
safely removes all children of the node.
Parameter |
Type |
Usage |
Description |
node |
DOMNode|String |
required |
a reference to a DOM node or an id. |
Examples
|
|
|
|
eval(
scriptFragment
: String
) :
void
Perform an evaluation in the global scope. Use this rather than
calling 'eval()' directly.
Placed in a separate function to minimize size of trapped
exceptions. Calling eval() directly from some other scope may
complicate tracebacks on some platforms.
Parameter |
Type |
Usage |
Description |
scriptFragment |
String |
required |
|
|
|
|
|
every(
arr
: Array|String
callback
: Function|String
thisObject
: Object
) :
void
Determines whether or not every item in arr satisfies the
condition implemented by callback.
Parameter |
Type |
Usage |
Description |
arr |
Array|String |
required |
the array to iterate on. If a string, operates on individual characters. |
callback |
Function|String |
required |
|
thisObject |
Object |
optional |
may be used to scope the call to callback |
Examples
|
|
|
|
exists(
name
: String
obj
: Object
) :
void
determine if an object supports a given method
useful for longer api chains where you have to test each object in
the chain. Useful only for object and method detection.
Not useful for testing generic properties on an object.
In particular, dojo.exists("foo.bar") when foo.bar = ""
will return false. Use ("bar" in foo) to test for those cases.
Parameter |
Type |
Usage |
Description |
name |
String |
required |
Path to an object, in the form "A.B.C". |
obj |
Object |
optional |
to use as root of path. Defaults to
'dojo.global'. Null may be passed. |
Examples
|
|
|
|
exit(
exitcode
) :
void
Parameter |
Type |
Usage |
Description |
exitcode |
|
required |
|
|
|
|
|
experimental(
moduleName
: String
extra
: String
) :
void
Marks code as experimental.
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 |
Usage |
Description |
moduleName |
String |
required |
The name of a module, or the name of a module file or a specific
function |
extra |
String |
optional |
some additional message for the user |
Examples
|
|
|
|
extend(
constructor
: Object
props
: Object
) :
void
Adds all properties and methods of props to constructor's
prototype, making them available to all instances created with
constructor.
Parameter |
Type |
Usage |
Description |
constructor |
Object |
required |
|
props |
Object |
one-or-more |
|
|
|
|
|
fadeIn(
args
: dojo.__FadeArgs
) :
void
Returns an animation that will fade node defined in 'args' from
its current opacity to fully opaque.
Parameter |
Type |
Usage |
Description |
args |
dojo.__FadeArgs |
required |
|
|
|
|
|
fadeOut(
args
: dojo.__FadeArgs
) :
void
Returns an animation that will fade node defined in 'args'
from its current opacity to fully transparent.
Parameter |
Type |
Usage |
Description |
args |
dojo.__FadeArgs |
required |
|
|
|
|
|
fieldToObject(
inputNode
: DOMNode||String
) :
void
Serialize a form field to a JavaScript object.
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.
Parameter |
Type |
Usage |
Description |
inputNode |
DOMNode||String |
required |
|
|
|
|
|
filter(
arr
: Array
callback
: Function|String
thisObject
: Object
) :
void
Returns a new Array with those items from arr that match the
condition implemented by callback.
Parameter |
Type |
Usage |
Description |
arr |
Array |
required |
the array to iterate over. |
callback |
Function|String |
required |
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. |
thisObject |
Object |
optional |
may be used to scope the call to callback |
Examples
|
|
|
|
fixEvent(
evt
: Event
sender
: DOMNode
) :
void
normalizes properties on the event object including event
bubbling methods, keystroke normalization, and x/y positions
Parameter |
Type |
Usage |
Description |
evt |
Event |
required |
native event object |
sender |
DOMNode |
required |
node to treat as "currentTarget" |
|
|
|
|
forEach(
arr
: Array|String
callback
: Function|String
thisObject
: Object
) :
void
for every item in arr, callback is invoked. Return values are ignored.
If you want to break out of the loop, consider using dojo.every() or dojo.some().
forEach does not allow breaking out of the loop over the items in arr.
Parameter |
Type |
Usage |
Description |
arr |
Array|String |
required |
the array to iterate over. If a string, operates on individual characters. |
callback |
Function|String |
required |
|
thisObject |
Object |
optional |
may be used to scope the call to callback |
Examples
|
|
|
|
formToJson(
formNode
: DOMNode||String
prettyPrint
: Boolean
) :
void
|
|
|
|
formToObject(
formNode
: DOMNode||String
) :
void
|
|
|
|
formToQuery(
formNode
: DOMNode||String
) :
void
|
|
|
|
fromJson(
json
: String
) :
void
Throws for invalid JSON strings, but it does not use a strict JSON parser. It
delegates to eval().
Parameter |
Type |
Usage |
Description |
json |
String |
required |
|
|
|
|
|
getComputedStyle(
node
: DOMNode
) :
void
Returns a "computed style" object.
Gets a "computed style" object which can be used to gather
information about the current state of the rendered node.
Note that this may behave differently on different browsers.
Values may have different formats and value encodings across
browsers.
Note also that this method is expensive. Wherever possible,
reuse the returned object.
Use the dojo.style() method for more consistent (pixelized)
return values.
Parameter |
Type |
Usage |
Description |
node |
DOMNode |
required |
A reference to a DOM node. Does NOT support taking an
ID string for speed reasons. |
Examples
|
|
|
|
getNodeProp(
node
: DomNode|String
name
: String
) :
void
Returns an effective value of a property or an attribute.
Parameter |
Type |
Usage |
Description |
node |
DomNode|String |
required |
id or reference to the element to remove the attribute from |
name |
String |
required |
the name of the attribute |
|
|
|
|
getObject(
name
: String
create
: Boolean
context
: Object
) :
void
Get a property from a dot-separated string, such as "A.B.C"
Useful for longer api chains where you have to test each object in
the chain, or when you have an object reference in string format.
Parameter |
Type |
Usage |
Description |
name |
String |
required |
Path to an property, in the form "A.B.C". |
create |
Boolean |
optional |
Optional. Defaults to false . If true , Objects will be
created at any point along the 'path' that is undefined. |
context |
Object |
optional |
Optional. Object to use as root of path. Defaults to
'dojo.global'. Null may be passed. |
|
|
|
|
handle(
loadOrError
: String
response
: Object
ioArgs
: dojo.__IoCallbackArgs
) :
void
Parameter |
Type |
Usage |
Description |
loadOrError |
String |
required |
Provides a string that tells you whether this function
was called because of success (load) or failure (error). |
response |
Object |
required |
The response in the format as defined with handleAs. |
ioArgs |
dojo.__IoCallbackArgs |
required |
Provides additional information about the request. |
|
|
|
|
hasAttr(
node
: DomNode|String
name
: String
) :
void
Returns true if the requested attribute is specified on the
given element, and false otherwise.
Parameter |
Type |
Usage |
Description |
node |
DomNode|String |
required |
id or reference to the element to check |
name |
String |
required |
the name of the attribute |
|
|
|
|
hasClass(
node
: DomNode|String
classStr
: String
) :
void
Returns whether or not the specified classes are a portion of the
class list currently applied to the node.
Parameter |
Type |
Usage |
Description |
node |
DomNode|String |
required |
String ID or DomNode reference to check the class for. |
classStr |
String |
required |
A string class name to look for. |
Examples
|
|
|
|
hash(
hash
: String
replace
: Boolean
) :
void
Gets or sets the hash string.
Handles getting and setting of location.hash.
- If no arguments are passed, acts as a getter.
- If a string is passed, acts as a setter.
Parameter |
Type |
Usage |
Description |
hash |
String |
optional |
|
replace |
Boolean |
optional |
|
|
|
|
|
hitch(
scope
: Object
method
: Function|String
) :
void
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.
Parameter |
Type |
Usage |
Description |
scope |
Object |
required |
The scope to use when method executes. If method is a string,
scope is also the object containing method. |
method |
Function|String |
required |
A function to be hitched to scope, or the name of the method in
scope to be hitched. |
Examples
|
|
|
|
indexOf(
array
: Array
value
: Object
fromIndex
: Integer
findLast
: Boolean
) :
void
locates the first index of the provided value in the
passed array. If the value is not found, -1 is returned.
Parameter |
Type |
Usage |
Description |
array |
Array |
required |
|
value |
Object |
required |
|
fromIndex |
Integer |
optional |
|
findLast |
Boolean |
optional |
|
|
|
|
|
isAlien(
it
: anything
) :
void
Returns true if it is a built-in function or some other kind of
oddball that *should* report as a function but doesn't
Parameter |
Type |
Usage |
Description |
it |
anything |
required |
|
|
|
|
|
isArray(
it
: anything
) :
void
Return true if it is an Array.
Does not work on Arrays created in other windows.
Parameter |
Type |
Usage |
Description |
it |
anything |
required |
|
|
|
|
|
isArrayLike(
it
: anything
) :
void
similar to dojo.isArray() but more permissive
Doesn't strongly test for "arrayness". Instead, settles for "isn't
a string or number and has a length property". Arguments objects
and DOM collections will return true when passed to
dojo.isArrayLike(), but will return false when passed to
dojo.isArray().
Parameter |
Type |
Usage |
Description |
it |
anything |
required |
|
|
|
|
|
isCopyKey(
e
: Event
) :
void
Checks an event for the copy key (meta on Mac, and ctrl anywhere else)
Parameter |
Type |
Usage |
Description |
e |
Event |
required |
Event object to examine |
|
|
|
|
isDescendant(
node
: DomNode|String
ancestor
: DomNode|String
) :
void
Returns true if node is a descendant of ancestor
Parameter |
Type |
Usage |
Description |
node |
DomNode|String |
required |
string id or node reference to test |
ancestor |
DomNode|String |
required |
string id or node reference of potential parent to test against |
Examples
|
|
|
|
isFunction(
it
: anything
) :
void
Return true if it is a Function
Parameter |
Type |
Usage |
Description |
it |
anything |
required |
|
|
|
|
|
isObject(
it
: anything
) :
void
Returns true if it is a JavaScript object (or an Array, a Function
or null)
Parameter |
Type |
Usage |
Description |
it |
anything |
required |
|
|
|
|
|
isString(
it
: anything
) :
void
Return true if it is a String
Parameter |
Type |
Usage |
Description |
it |
anything |
required |
|
|
|
|
|
lastIndexOf(
array
: Array
value
: Object
fromIndex
: Integer
) :
void
locates the last index of the provided value in the passed
array. If the value is not found, -1 is returned.
Parameter |
Type |
Usage |
Description |
array |
Array |
required |
|
value |
Object |
required |
|
fromIndex |
Integer |
optional |
|
|
|
|
|
loaded(
) :
void
signal fired when initial environment and package loading is
complete. You should use dojo.addOnLoad() instead of doing a
direct 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.
|
|
|
|
loadInit(
init
: Function
) :
void
Executes a function that needs to be executed for the loader's dojo.requireIf
resolutions to work. This is needed mostly for the xdomain loader case where
a function needs to be executed to set up the possible values for a dojo.requireIf
call.
This function is mainly a marker for the xdomain loader to know parts of
code that needs be executed outside the function wrappper that is placed around modules.
The init function could be executed more than once, and it should make no assumptions
on what is loaded, or what modules are available. Only the functionality in Dojo Base
is allowed to be used. Avoid using this method. For a valid use case,
see the source for dojox.gfx.
Parameter |
Type |
Usage |
Description |
init |
Function |
required |
a function reference. Executed immediately. |
|
|
|
|
map(
arr
: Array|String
callback
: Function|String
thisObject
: Function
) :
void
applies callback to each element of arr and returns
an Array with the results
Parameter |
Type |
Usage |
Description |
arr |
Array|String |
required |
the array to iterate on. If a string, operates on
individual characters. |
callback |
Function|String |
required |
a function is invoked with three arguments, (item, index,
array), and returns a value |
thisObject |
Function |
optional |
may be used to scope the call to callback |
Examples
|
|
|
|
marginBox(
node
: DomNode|String
box
: Object
) :
void
Getter/setter for the margin-box of node.
Getter/setter for the margin-box of node.
Returns an object in the expected format of box (regardless
Parameter |
Type |
Usage |
Description |
node |
DomNode|String |
required |
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. |
Examples
|
|
|
|
mixin(
obj
: Object
props
: Object
) :
void
Adds all properties and methods of props to obj and returns the
(now modified) obj.
`dojo.mixin` can mix multiple source objects into a
destination object which is then returned. Unlike regular
`for...in` iteration, `dojo.mixin` is also smart about avoiding
extensions which other toolkits may unwisely add to the root
object prototype
Parameter |
Type |
Usage |
Description |
obj |
Object |
required |
The object to mix properties into. Also the return value. |
props |
Object |
one-or-more |
One or more objects whose values are successively copied into
obj. If more than one of these objects contain the same value,
the one specified last in the function call will "win". |
Examples
|
|
|
|
moduleUrl(
module
: String
url
: dojo._Url||String
) :
void
Returns a dojo._Url object relative to a module.
Parameter |
Type |
Usage |
Description |
module |
String |
required |
|
url |
dojo._Url||String |
required |
|
Examples
|
|
|
|
objectToQuery(
map
: Object
) :
void
takes a name/value mapping object and returns a string representing
a URL-encoded version of that object.
Parameter |
Type |
Usage |
Description |
map |
Object |
required |
|
Examples
|
|
|
|
partial(
method
: Function|String
) :
void
similar to hitch() except that the scope object is left to be
whatever the execution context eventually becomes.
Parameter |
Type |
Usage |
Description |
method |
Function|String |
required |
|
|
|
|
|
place(
node
: String|DomNode
refNode
: String|DomNode
position
: String|Number
) :
void
Attempt to insert node into the DOM, choosing from various positioning options.
Returns the first argument resolved to a DOM node.
Parameter |
Type |
Usage |
Description |
node |
String|DomNode |
required |
id or node reference, or HTML fragment starting with "<" to place relative to refNode |
refNode |
String|DomNode |
required |
id or node reference to use as basis for placement |
position |
String|Number |
optional |
string noting the position of node relative to refNode or a
number indicating the location in the childNodes collection of refNode. |
Examples
|
|
|
|
platformRequire(
modMap
: Object
) :
void
|
|
|
|
popContext(
) :
void
If the context stack contains elements, ensure that
subsequent code executes in the *previous* context to the
current context. The current context set ([global,
document]) is returned.
|
|
|
|
position(
node
: DomNode
includeScroll
: Boolean
) :
void
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).
Parameter |
Type |
Usage |
Description |
node |
DomNode |
required |
|
includeScroll |
Boolean |
optional |
|
|
|
|
|
provide(
resourceName
: String
) :
void
Register a resource with the package system. Works in conjunction with dojo.require
Each javascript source file is called a resource. When a
resource is loaded by the browser, `dojo.provide()` registers
that it has been loaded.
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("dojo.foo");` before any calls to
`dojo.require()` are made.
For backwards compatibility reasons, in addition to registering
the resource, `dojo.provide()` also ensures that the javascript
object for the module exists. For example,
`dojo.provide("dojox.data.FlickrStore")`, in addition to
registering that `FlickrStore.js` is a resource for the
`dojox.data` module, will ensure that the `dojox.data`
javascript object exists, so that calls like
`dojo.data.foo = function(){ ... }` don't fail.
In the case of a build where multiple javascript source files
are combined into one bigger file (similar to a .lib or .jar
file), that file may contain multiple dojo.provide() calls, to
note that it includes multiple resources.
Parameter |
Type |
Usage |
Description |
resourceName |
String |
required |
A dot-sperated string identifying a resource. |
Examples
|
|
|
|
publish(
topic
: String
args
: Array
) :
void
Invoke all listener method subscribed to topic.
Parameter |
Type |
Usage |
Description |
topic |
String |
required |
The name of the topic to publish. |
args |
Array |
required |
An array of arguments. The arguments will be applied
to each topic subscriber (as first class parameters, via apply). |
Examples
|
|
|
|
pushContext(
g
: Object|String
d
: MDocumentElement
) :
void
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 |
Usage |
Description |
g |
Object|String |
optional |
The global context. If a string, the id of the frame to
search for a context and document. |
d |
MDocumentElement |
optional |
The document element to execute subsequent code with. |
|
|
|
|
query(
query
: String
root
: String|DOMNode
listCtor
: Function
) :
void
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.
dojo.query() is the swiss army knife of DOM node manipulation in
Dojo. Much like Prototype's "$$" (bling-bling) function or JQuery's
"$" function, dojo.query provides robust, high-performance
CSS-based node selector support with the option of scoping searches
to a particular sub-tree of a document.
Parameter |
Type |
Usage |
Description |
query |
String |
required |
The CSS3 expression to match against. For details on the syntax of |
root |
String|DOMNode |
optional |
A DOMNode (or node id) to scope the search from. Optional. |
listCtor |
Function |
optional |
|
Examples
|
|
|
|
queryToObject(
str
: String
) :
void
Create an object representing a de-serialized query section of a
URL. Query keys with multiple values are returned in an array.
Parameter |
Type |
Usage |
Description |
str |
String |
required |
|
Examples
|
|
|
|
rawXhrPost(
) :
void
|
|
|
|
rawXhrPut(
) :
void
|
|
|
|
ready(
) :
void
|
|
|
|
registerModulePath(
module
: String
prefix
: String
) :
void
Maps a module name to a path
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 |
Usage |
Description |
module |
String |
required |
|
prefix |
String |
required |
|
Examples
|
|
|
|
removeAttr(
node
: DomNode|String
name
: String
) :
void
Removes an attribute from an HTML element.
Parameter |
Type |
Usage |
Description |
node |
DomNode|String |
required |
id or reference to the element to remove the attribute from |
name |
String |
required |
the name of the attribute to remove |
|
|
|
|
removeClass(
node
: DomNode|String
classStr
: String|Array
) :
void
Removes the specified classes from node. No dojo.hasClass
check is required.
Parameter |
Type |
Usage |
Description |
node |
DomNode|String |
required |
String ID or DomNode reference to remove the class from. |
classStr |
String|Array |
optional |
An optional String class name to remove, or several space-separated
class names, or an array of class names. If omitted, all class names
will be deleted. |
Examples
|
|
|
|
replace(
tmpl
: String
map
: Object|Function
pattern
: RegEx
) :
void
Performs parameterized substitutions on a string. Throws an
exception if any parameter is unmatched.
Parameter |
Type |
Usage |
Description |
tmpl |
String |
required |
String to be used as a template. |
map |
Object|Function |
required |
If an object, it is used as a dictionary to look up substitutions.
If a function, it is called for every substitution with following |
pattern |
RegEx |
optional |
Optional regular expression objects that overrides the default pattern. |
Examples
|
|
|
|
require(
moduleName
: String
omitModuleCheck
: Boolean
) :
void
loads a Javascript module from the appropriate URI
Parameter |
Type |
Usage |
Description |
moduleName |
String |
required |
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) |
|
|
|
|
requireIf(
condition
: Boolean
resourceName
: String
) :
void
If the condition is true then call dojo.require() for the specified
resource
Parameter |
Type |
Usage |
Description |
condition |
Boolean |
required |
|
resourceName |
String |
required |
|
Examples
|
|
|
|
requireLocalization(
moduleName
: String
bundleName
: String
locale
: String
availableFlatLocales
: String
) :
void
loads a bundle intelligently based on whether the module is
local or xd. Overrides the local-case implementation.
Load translated resource bundles provided underneath the "nls"
directory within a package. Translated resources may be located in
different packages throughout the source tree.
Each directory is named for a locale as specified by RFC 3066,
Parameter |
Type |
Usage |
Description |
moduleName |
String |
required |
name of the package containing the "nls" directory in which the
bundle is found |
bundleName |
String |
required |
bundle name, i.e. the filename without the '.js' suffix. Using "nls" as a
a bundle name is not supported, since "nls" is the name of the folder
that holds bundles. Using "nls" as the bundle name will cause problems
with the custom build. |
locale |
String |
optional |
the locale to load (optional) By default, the browser's user
locale as defined by dojo.locale |
availableFlatLocales |
String |
optional |
A comma-separated list of the available, flattened locales for this
bundle. This argument should only be set by the build process. |
Examples
|
|
|
|
safeMixin(
target
: Object
source
: Object
) :
void
Mix in properties skipping a constructor and decorating functions
like it is done by dojo.declare.
This function is used to mix in properties like dojo._mixin does,
but it skips a constructor property and decorates functions like
dojo.declare does.
It is meant to be used with classes and objects produced with
dojo.declare. Functions mixed in with dojo.safeMixin can use
this.inherited() like normal methods.
This function is used to implement extend() method of a constructor
produced with dojo.declare().
Parameter |
Type |
Usage |
Description |
target |
Object |
required |
Target object to accept new properties. |
source |
Object |
required |
Source object for new properties. |
Examples
|
|
|
|
setContext(
globalObject
: Object
globalDocument
: DocumentElement
) :
void
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.
Parameter |
Type |
Usage |
Description |
globalObject |
Object |
required |
|
globalDocument |
DocumentElement |
required |
|
|
|
|
|
setObject(
name
: String
value
: Object
context
: Object
) :
void
Set a property from a dot-separated string, such as "A.B.C"
Useful for longer api chains where you have to test each object in
the chain, or when you have an object reference in string format.
Objects are created as needed along `path`. Returns the passed
value if setting is successful or `undefined` if not.
Parameter |
Type |
Usage |
Description |
name |
String |
required |
Path to a property, in the form "A.B.C". |
value |
Object |
required |
|
context |
Object |
optional |
Optional. Object to use as root of path. Defaults to
dojo.global . |
Examples
|
|
|
|
setSelectable(
node
: DomNode|String
selectable
: Boolean
) :
void
Enable or disable selection on a node
Parameter |
Type |
Usage |
Description |
node |
DomNode|String |
required |
id or reference to node |
selectable |
Boolean |
required |
state to put the node in. false indicates unselectable, true
allows selection. |
Examples
|
|
|
|
some(
arr
: Array|String
callback
: Function|String
thisObject
: Object
) :
void
Determines whether or not any item in arr satisfies the
condition implemented by callback.
Parameter |
Type |
Usage |
Description |
arr |
Array|String |
required |
the array to iterate over. If a string, operates on individual characters. |
callback |
Function|String |
required |
|
thisObject |
Object |
optional |
may be used to scope the call to callback |
Examples
|
|
|
|
stopEvent(
evt
: Event
) :
void
prevents propagation and clobbers the default action of the
passed event
Parameter |
Type |
Usage |
Description |
evt |
Event |
required |
The event object. If omitted, window.event is used on IE. |
|
|
|
|
style(
node
: DomNode|String
style
: String|Object
value
: String
) :
void
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 |
Usage |
Description |
node |
DomNode|String |
required |
id or reference to node to get/set style for |
style |
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, |
Examples
|
|
|
|
subscribe(
topic
: String
context
: Object|null
method
: String|Function
) :
void
Attach a listener to a named topic. The listener function is invoked whenever the
Parameter |
Type |
Usage |
Description |
topic |
String |
required |
|
context |
Object|null |
required |
Scope in which method will be invoked, or null for default scope. |
method |
String|Function |
required |
The name of a function in context, or a function reference. This is the function that
is invoked when topic is published. |
Examples
|
|
|
|
toggleClass(
node
: DomNode|String
classStr
: String|Array
condition
: Boolean
) :
void
Adds a class to node if not present, or removes if present.
Pass a boolean condition if you want to explicitly add or remove.
Parameter |
Type |
Usage |
Description |
node |
DomNode|String |
required |
|
classStr |
String|Array |
required |
|
condition |
Boolean |
optional |
If passed, true means to add the class, false means to remove. |
Examples
|
|
|
|
toJson(
it
: Object
prettyPrint
: Boolean
_indentStr
: String
) :
void
Parameter |
Type |
Usage |
Description |
it |
Object |
required |
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. |
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(). |
_indentStr |
String |
optional |
private variable for recursive calls when pretty printing, do not use. |
Examples
|
|
|
|
trim(
str
: String
) :
void
Trims whitespace from both sides of the string
This version of trim() was selected for inclusion into the base due
to its compact size and relatively good performance
Parameter |
Type |
Usage |
Description |
str |
String |
required |
String to be trimmed |
|
|
|
|
unloaded(
) :
void
signal fired by impending environment destruction. You should use
dojo.addOnUnload() instead of doing a direct dojo.connect() to this
method to perform page/application cleanup methods. See
dojo.addOnUnload for more info.
|
|
|
|
unsubscribe(
handle
: Handle
) :
void
Remove a topic listener.
Parameter |
Type |
Usage |
Description |
handle |
Handle |
required |
The handle returned from a call to subscribe. |
Examples
|
|
|
|
version(
) :
void
Version number of the Dojo Toolkit
|
|
|
|
windowUnloaded(
) :
void
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
: DocumentElement
callback
: Function
thisObject
: Object
cbArguments
: Array
) :
void
Invoke callback with documentObject as dojo.doc.
Invoke callback with documentObject as dojo.doc. If provided,
callback will be executed in the context of object thisObject
When callback() returns or throws an error, the dojo.doc will
be restored to its previous state.
Parameter |
Type |
Usage |
Description |
documentObject |
DocumentElement |
required |
|
callback |
Function |
required |
|
thisObject |
Object |
optional |
|
cbArguments |
Array |
optional |
|
|
|
|
|
withGlobal(
globalObject
: Object
callback
: Function
thisObject
: Object
cbArguments
: Array
) :
void
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.
Parameter |
Type |
Usage |
Description |
globalObject |
Object |
required |
|
callback |
Function |
required |
|
thisObject |
Object |
optional |
|
cbArguments |
Array |
optional |
|
|
|
|
|
xdRequireLocalization(
m
b
locale
: String
fLocales
moduleName
: String
bundleName
: String
availableFlatLocales
: String
) :
void
Internal xd loader function. The xd version of dojo.requireLocalization.
Parameter |
Type |
Usage |
Description |
m |
|
required |
|
b |
|
required |
|
locale |
String |
optional |
|
fLocales |
|
required |
|
moduleName |
String |
required |
|
bundleName |
String |
required |
|
availableFlatLocales |
String |
required |
|
|
|
|
|
xhr(
method
: String
args
: dojo.__XhrArgs
hasBody
: Boolean
) :
void
Sends an HTTP request with the given method.
Sends an HTTP request with the given method.
See also 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.
Parameter |
Type |
Usage |
Description |
method |
String |
required |
HTTP method to be used, such as GET, POST, PUT, DELETE. Should be uppercase. |
args |
dojo.__XhrArgs |
required |
|
hasBody |
Boolean |
optional |
If the request has an HTTP body, then pass true for hasBody. |
|
|
|
|
xhrDelete(
args
: dojo.__XhrArgs
) :
void
Sends an HTTP DELETE request to the server.
Parameter |
Type |
Usage |
Description |
args |
dojo.__XhrArgs |
required |
|
|
|
|
|
xhrGet(
args
: dojo.__XhrArgs
) :
void
Sends an HTTP GET request to the server.
Parameter |
Type |
Usage |
Description |
args |
dojo.__XhrArgs |
required |
|
|
|
|
|
xhrPost(
args
: dojo.__XhrArgs
) :
void
Sends an HTTP POST request to the server. In addtion to the properties
Parameter |
Type |
Usage |
Description |
args |
dojo.__XhrArgs |
required |
|
|
|
|
|
xhrPut(
args
: dojo.__XhrArgs
) :
void
Sends an HTTP PUT request to the server. In addtion to the properties
Parameter |
Type |
Usage |
Description |
args |
dojo.__XhrArgs |
required |
|
|