Opened 12 years ago

Closed 12 years ago

#4626 closed defect (invalid)

[StackContainer] bug in addChild()/_setupChild()

Reported by: guest Owned by: Adam Peller
Priority: high Milestone: 1.0
Component: Dijit Version: 0.9
Keywords: StackContainer child page addChild _setupChild Cc:
Blocked By: Blocking:

Description

In the addChild function, the _setupChild is used. After this use, child became null. The _setupChild 's usage in addChild isn't correct:

child=this._setupChild(child);

the "child=" is uncessary and "this._setupChild(child)" is sufficient and doesn't create bug.

functions code:

addChild: function(/*Widget*/ child, /*Integer?*/ insertIndex)
	{
		dijit._Container.prototype.addChild.apply(this, arguments);
		child=this._setupChild(child);

		if(this._started){
			// in case the tab titles have overflowed from one line to two lines
			this.layout();
			dojo.publish(this.id+"-addChild", [child]);

			// if this is the first child, then select it
			if(!this.selectedChildWidget){
				this.selectChild(child);
			}
		}
	},
_setupChild: function(/*Widget*/ page){
		// Summary: prepare the given child

		page.domNode.style.display = "none";

		// since we are setting the width/height of the child elements, they need
		// to be position:relative, or IE has problems (See bug #2033)
		page.domNode.style.position = "relative";
		return page;
	},

Change History (3)

comment:1 Changed 12 years ago by Adam Peller

Milestone: 1.0
Owner: set to Adam Peller

comment:2 Changed 12 years ago by Adam Peller

right... I think the child= assignment was there from the time when setupChild used to actually alter the child in subclasses (AccordionContainer? used to do this, it doesn't anymore)

I'm not sure I see the harm in leaving this assignment there. _setupChild returns the argument which is passed in, so the variable is assigned to itself. What's the bug? How is it reproduced?

comment:3 Changed 12 years ago by Adam Peller

Resolution: invalid
Status: newclosed

please reopen with a test case

Note: See TracTickets for help on using tickets.