Opened 14 years ago

Closed 14 years ago

#147 closed defect (fixed)

insertAtIndex is confusing

Reported by: david Owned by: anonymous
Priority: high Milestone:
Component: Core Version: 0.1
Keywords: Cc:
Blocked By: Blocking:

Description

the function signature for dojo.dom.insertAtIndex is as follows:

dojo.dom.insertAtIndex(node, ref, insertionIndex);

The problem is that ref isnt the node we want to insert the node within, rather, it is a node within a node that we want to put node in (confusing, I know). I think we need to change this so that ref is the containing node that node should be placed in. This is useful for inserting at position 0 on what may or may not be an empty containing node and not force the user to reference some random child node as ref. So, instead of having this:

dojo.dom.insertAtIndex(node, ref.firstChild, 7); // what if ref.firstChild is null?

We end up with:

dojo.dom.insertAtIndex(node, ref, 7);

It's cleaner, intuitive, and even mows the lawn!

Change History (3)

comment:1 Changed 14 years ago by david

Resolution: fixed
Status: newclosed

(In [1749]) fixes #147

comment:2 Changed 14 years ago by erik@…

Resolution: fixed
Status: closedreopened

The if(!placed) branch needs to be updated to use the renamed argument

comment:3 Changed 14 years ago by david

Resolution: fixed
Status: reopenedclosed

Fixed by [1799]

Note: See TracTickets for help on using tickets.