#16629 closed defect (fixed)
StatefulArray incorrect implementation of concat
Reported by: | ben hockey | Owned by: | Ed Chatelain |
---|---|---|---|
Priority: | undecided | Milestone: | 1.8.4 |
Component: | DojoX MVC | Version: | 1.8.3 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
calling concat on a StatefulArray? with no args will add an undefined element to the array.
var arr = new StatefulArray(['alice', 'bob']), copy = arr.concat(); console.log(copy); // ['alice', 'bob', undefined]
it is also not possible to concat more than one array together or add multiple elements (see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/concat for API regarding how arrays concat multiple arguments)
a possible implementation to fix this might be
concat: function () { return new StatefulArray([].concat.apply(this, arguments)); }
see http://jsfiddle.net/neonstalwart/aqphE/ for a small test page
Change History (3)
comment:1 Changed 8 years ago by
comment:3 Changed 8 years ago by
Milestone: | tbd → 1.8.4 |
---|
Note: See
TracTickets for help on using
tickets.
In [30488]: