Opened 8 years ago

Closed 3 years ago

#13959 closed enhancement (fixed)

improve modules to not automatically augment the dojo module value

Reported by: Rawld Gill Owned by: Rawld Gill
Priority: low Milestone: 1.11
Component: Core Version: 1.7.0b1
Keywords: Cc:
Blocked By: Blocking:

Description

As of 1.7, many modules attempt to return a module value but also modify dojo. In some cases this may be the intended semantics, but in many cases it is neither necessary nor desirable. For example, the dojo array functions (forEach, index, etc.) should be returned by the module that defines them (dojo/_base/array), but there is no need to automatically and unconditionally push them into the dojo object also.

Since much of the 1.x code and 1.x-dependent code in the wild depends on dojo being populated as such, it is impossible to make this change unconditionally in the 1.x line. The has feature flag "extend-dojo" (defaults to truthy), has been added which instructs modules to push their values into the dojo object. For example, the last few lines of dojo/_base/array look like this:

	array = {
		every:       everyOrSome(false),
		//etc...
		clearCache:  clearCache
	};

	has("extend-dojo") && lang.mixin(dojo, array);

	/*===== return dojo.array; =====*/
	return array;
});

By setting extend-dojo to falsy, it is possible to load/use any module that leverages the feature without polluting the dojo object.

Note: this feature was originally named dojo-1x-base. It was renamed because the issue does not apply to base alone.

This is a meta ticket to track enhancing modules to conditionally use this pattern.

Change History (8)

comment:1 Changed 8 years ago by Rawld Gill

In [26612]:

moved has extend-dojo feature to dojo/kernel; refs #13959; fixes #13484; !strict

comment:2 Changed 8 years ago by Rawld Gill

Status: newassigned

comment:3 Changed 7 years ago by bill

In [26965]:

Modifying files that call lang.getObject("foo", true, dojo) to remove unneeded references to dojo variable, refs #13959 !strict.

Skipping i18n.js since it has a dojo.xhr() missing dependency issue, refs #14211.

comment:4 Changed 7 years ago by bill

In [26966]:

Fix name clash; since there were already local variables called "locale", name the exports variable "exports". Refs #13959 !strict.

comment:5 Changed 7 years ago by bill

In [28616]:

Minimize refs to dojo "global", and only augment dojo when has("extend-dojo") is true, refs #13959 !strict

comment:6 Changed 7 years ago by bill

In [28621]:

Minimize refs to dojo "global", and only augment dojo when has("extend-dojo") is true, refs #13959 !strict

comment:7 Changed 7 years ago by Colin Snover

Milestone: 1.82.0

1.8 is frozen. Move all enhancements to next release. If you need an exemption from the freeze for this ticket, contact me immediately.

comment:8 Changed 3 years ago by dylan

Milestone: 2.01.11
Resolution: fixed
Status: assignedclosed

Meta ticket seems to not be actively used any more. Closing as fixed (at least as much as it's going to be for 1.x).

Note: See TracTickets for help on using tickets.