W3cubDocs

/Dojo

dojo/_base/window

Summary

API to save/set/restore the global/document scope.

See the dojo/_base/window reference documentation for more information.

Properties

doc

Defined by: dojo/_base/window

Alias for the current document. 'doc' can be modified for temporary context shifting. See also withDoc().

global

Defined by: dojo/_base/window

Alias for the current window. 'global' can be modified for temporary context shifting. See also withGlobal().

Methods

body(doc)

Defined by dojo/_base/window

Return the body element of the specified document or of dojo/_base/window::doc.

Parameter Type Description
doc Document
Optional

Returns: undefined

Examples

Example 1

win.body().appendChild(dojo.doc.createElement('div'));

setContext(globalObject,globalDocument)

Defined by dojo/_base/window

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 Description
globalObject Object
globalDocument DocumentElement

withDoc(documentObject,callback,thisObject,cbArguments)

Defined by dojo/_base/window

Invoke callback with documentObject as dojo/_base/window::doc.

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)

Defined by dojo/_base/window

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 Description
globalObject Object
callback Function
thisObject Object
Optional
cbArguments Array
Optional

Returns: undefined

© 2005–2017 JS Foundation
Licensed under the AFL 2.1 and BSD 3-Clause licenses.
http://dojotoolkit.org/api/1.10/dojo/_base/window.html