Opened 7 years ago

Closed 4 years ago

#15275 closed task (fixed)

clean up, etc.

Reported by: bill Owned by:
Priority: undecided Milestone: 2.0
Component: Core Version: 1.7.2
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

(in progress ticket based on in our code are confusingly used to refer to both to a global context, and to the current window. To separate those concepts, possible cleanup includes:

(1) replace non-UI uses of (i.e. usages that aren't assuming that refers to a Window object)

For modules that need access to the global context, they can use either this:

define([], function(){
   var global = this;

or use

define(["dojo/_base/kernel"], function(kernel){
   var global =;

The former is preferable since it's simpler, but is a hairline break in backwards compatibility, so maybe should wait for 2.0.

(2) replace UI usages of with

For clarity, make a new variable called that is the Window object associated with win.doc. Update code referencing as a Window to use instead.

Deprecate win.withGlobal() in favor of a method call win.withWindow(). Make both win.withWindow() and win.withDoc() set both and win.doc. The latter requires moving the code in dojo/window::get() to dojo/_base/window, so that win.withDoc() can figure out the window associated w/the specified document.

The other alternative is to get rid of win.withDoc() and win.withGlobal() altogether. Except for a few open issues listed in #15216, they aren't really necessary anymore, although arguably they are convenient in some special cases.

See also #14690 and #15216

Change History (4)

comment:1 Changed 7 years ago by bill

In [28455]:

When is used as a scope for global variables, rather than a reference to the browser's Window object, use instead. I'd prefer to use neither but that's an arguable break in backwards compatibility. At least this makes things clearer and in many cases removes the dependency on dojo/_base/window.

Refs #15275 !strict.

comment:2 Changed 7 years ago by bill

Description: modified (diff)

comment:3 Changed 7 years ago by bill

Milestone: tbd2.0

comment:4 Changed 4 years ago by dylan

Component: GeneralCore
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.