Opened 12 years ago

Closed 12 years ago

#4177 closed defect (fixed)

non-zero insertIndex in programmatic TabContainer.addChild()

Reported by: gizmojo.org Owned by: Adam Peller
Priority: high Milestone: 1.0
Component: Dijit Version: 0.9
Keywords: inserIndex Cc:
Blocked By: Blocking:

Description

FF2.0, W2k, Dojo rev 10182.

Doing addChild() on a programmatically created TabContainer? (but used an existing div element as target) starting the insertIndex count from 1 seems to work just fine.

However, doing the same on a programmatically created TabContainer? that uses a dynamically created div element as target, then starting the insertIndex from 1 gives a ref has no properties error.

A test file (plus some more description) to reproduce the problem is at: http://dojotoolkit.org/forum/dijit-dijit-0-9/dijit-support/non-zero-insertindex-programmatic-tabcontainer-addchild

Attachments (1)

4177.patch (1.0 KB) - added by Adam Peller 12 years ago.
insert at nth widget, not nth dom node

Download all attachments as: .zip

Change History (7)

comment:1 Changed 12 years ago by Adam Peller

Milestone: 1.0
Owner: set to Adam Peller

Changed 12 years ago by Adam Peller

Attachment: 4177.patch added

insert at nth widget, not nth dom node

comment:2 Changed 12 years ago by Adam Peller

I think the test case should fail, but it should fail consistently. Inserting at position 1 when there is nothing at position 0 should result in an exception. The reason it succeeds the first time is because the unnormalized DOM has empty text nodes.

Container.addChild should be adding based on the # position of widgets, not nodes. I'm attaching a patch, but I need to work up a better test to make sure it's right.

comment:3 Changed 12 years ago by bill

Cool, looks good (well I haven't tried it but it look good), except that I think the query should be "> [widgetid]" not just "[widgetid]" since you only want to find children, not all descendants. See getChildren() function for an example.

comment:4 Changed 12 years ago by gizmojo.org

Cc: mario@… removed

comment:5 Changed 12 years ago by gizmojo.org

Reporter: changed from guest to gizmojo.org

comment:6 Changed 12 years ago by Adam Peller

Resolution: fixed
Status: newclosed

(In [10715]) Fix addChild insertion into _Container and StackContainer? specifying index. Fixes #4177

Note: See TracTickets for help on using tickets.