Opened 11 years ago

Closed 11 years ago

#7547 closed enhancement (fixed)

Remove unnecessary code

Reported by: Eugene Lazutkin Owned by: bill
Priority: high Milestone: 1.2
Component: Dijit Version: 1.1.1
Keywords: Cc:
Blocked By: Blocking:

Description

Due to fixing bugs in dojo.place(), the explicit use of the default parameter is not required anymore. Following snippet from the beginning of dijit._Container.addChild() can be safely removed:

if(insertIndex === undefined){
  insertIndex = "last";
}

Change History (6)

comment:1 Changed 11 years ago by Eugene Lazutkin

The corresponding ticket for Dojo Core is #7547.

comment:2 Changed 11 years ago by Eugene Lazutkin

Correction: the corresponding ticket for Dojo Core is #7546.

comment:3 Changed 11 years ago by bill

Milestone: tbd1.2

Seems like we can get rid of the next block too:

			var refNode = this.containerNode;
			if(insertIndex && typeof insertIndex == "number"){
				var children = dojo.query("> [widgetId]", refNode);
				if(children && children.length >= insertIndex){
					refNode = children[insertIndex-1];
					insertIndex = "after";
				}
			}

comment:4 Changed 11 years ago by Eugene Lazutkin

I am not so sure. dojo.placw works with all node's children, while this snippet works only with children that have "widgetId" attribute set. Please verify that removing this condition will not break the function.

comment:5 Changed 11 years ago by bill

Owner: set to bill
Status: newassigned

Hmm, good point. In general all child nodes of this.containerNode are widgets, but I suppose that's not guaranteed (although I notice that getNextSibling() / getPreviousSibling() will break if that isn't the case).

I'll just remove those three lines for now.

comment:6 Changed 11 years ago by bill

Resolution: fixed
Status: assignedclosed

(In [14991]) Remove unnecessary code, fixes #7547.

Note: See TracTickets for help on using tickets.