qooxdoo / qooxdoo

qooxdoo - Universal JavaScript Framework
http://qooxdoo.org
Other
764 stars 260 forks source link

Indexing if qx array initialized by js array #10600

Closed goldim closed 1 year ago

goldim commented 1 year ago

If to initialize qx.data.Array by JS Array and try to get values via index operation then values are incorrect.

const a = new qx.data.Array([1,2,3]);
console.log(a[0], a[1]);

The playground show undefined result for both a[0] and a[1]. Also I think unit tests for that case would be nice.

Qx version is 7.6.0

derrell commented 1 year ago

In qooxdoo prior to version 8, you can not use array indexing to access the elements of the (internal) array. Instead, you use a method, e.g., console.log(a.getItem(0), a.getItem(1));

The upcoming version 8.0 supports an experimental feature that allows setting and getting array elements of a qx.data.Array using normal array indexing, so that your example would work.

goldim commented 1 year ago

@derrell Sorry, you are totally right. I thought somehow that was recently added with a PR about array but there was about making qx.data.Array iterable. Thank you. I will close it.