Opened 12 years ago

Closed 12 years ago

Last modified 10 years ago

#4821 closed defect (fixed)

No clean, quick way to create a NodeList from an Array

Reported by: ptwobrussell Owned by: alex
Priority: high Milestone: 1.0
Component: Core Version: 1.0
Keywords: Cc: ptwobrussell@…
Blocked By: Blocking:

Description

Right now, if you try to create a NodeList? from an Array like so:

var a = [1,2,3,4]

var n = new dojo.NodeList?(a)

you end up with a NodeList? that contains a single array as its element instead of a NodeList? that contains the elements contained in the Array.

Per a conversation with Alex, it should be a lot easier to "cast" an Array into a NodeList?.

My personal thoughts are that when people find out how cool NodeLists? are, they will being to prefer them as a drop in replacement for Arrays. The chaining syntax is just that cool. So...we may want to doubly check that all of the dojo.* methods for array processing map directly to NodeList? as well?

Change History (3)

comment:1 Changed 12 years ago by ptwobrussell

Cc: ptwobrussell@… added; ptwobrussell removed

comment:2 Changed 12 years ago by alex

Resolution: fixed
Status: newclosed

(In [11044]) Fixes #4821. Fixes #4378. Now NodeLists? are just arrays augmented with extra methods. splice() and slice() are still oddballs, but will be fixed shortly (in the same manner).

comment:3 Changed 12 years ago by alex

just for the record, the new fast-path for NodeList?-from-array is:

   dojo.NodeList().concat([...], ...);
Note: See TracTickets for help on using tickets.