dojo/_base/window (version 1.10)

Summary

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

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

Property Summary

  • docAlias for the current document. 'doc' can be modified for temporary context shifting.
  • globalAlias for the current window. 'global' can be modified for temporary context shifting.

Method Summary

  • body(doc) Return the body element of the specified document or of dojo/_base/window::doc.
  • 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).
  • withDoc(documentObject,callback,thisObject,cbArguments) Invoke callback with documentObject as dojo/_base/window::doc.
  • withGlobal(globalObject,callback,thisObject,cbArguments) Invoke callback with globalObject as dojo.global and globalObject.document as dojo.doc.

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
Error in the documentation? Can’t find what you are looking for? Let us know!