[ng-dhtml] [Dojo-checkins] [dojo] #147: insertAtIndex is confusing

David Schontzler schontz at gmail.com
Wed Oct 12 16:51:43 CDT 2005


Fixed as of r1749.

On 10/12/05, David Schontzler <schontz at gmail.com> wrote:
> Hey folks-
>
> I just filed this bug and was looking at fixing it, but I wanted to
> give everyone a heads up in you are currently using
> dojo.dom.insertAtIndex. If you think I'm off my rocker, let me know,
> and I'll consider not changing it. :)
>
> -d
>
> ---------- Forwarded message ----------
> From: dojo-checkins at dojotoolkit.org <dojo-checkins at dojotoolkit.org>
> Date: Oct 12, 2005 11:19 AM
> Subject: [Dojo-checkins] [dojo] #147: insertAtIndex is confusing
> To: dojo-checkins at dojotoolkit.org
>
>
> #147: insertAtIndex is confusing
> -----------------------+----------------------------------------------------
>        Id:  147        |      Status:  new
> Component:  Core       |    Modified:  Wed 12 Oct 2005 11:19:21 AM PDT
>  Severity:  normal     |   Milestone:
>  Priority:  normal     |     Version:  0.1
>     Owner:  anonymous  |    Reporter:  david
> -----------------------+----------------------------------------------------
>  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!
>
> --
> Ticket URL: <http://dojotoolkit.org/trac/ticket/147>
> dojo <http://dojotoolkit.org/>
> The Dojo UI Toolkit
> _______________________________________________
> Dojo-checkins mailing list
> Dojo-checkins at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-checkins
>



More information about the NG-DHTML mailing list