Using arrays in platform APIs

Allen, we discussed this briefly during the last TC39 meeting and it
seemed you had some different ideas on how to approach these.

1) Exposing file-like objects through <input type=type>.files as
array. Modifications to the array (e.g. via push()) would take affect.
The way this is accomplished is through the <input type=file>
implementation using Array.observe(). Elements in the array that are
not Blob or File would be ignored.

2) Exposing a list of elements as the result of a query operation on a
DOM. The idea is to have a subclass of Array named Elements on which
you can perform further queries.

In both cases reusing Array is convenient as it guarantees all the
Array methods to be available as well as future Array methods and does
not require re-implementing them.


-- 
http://annevankesteren.nl/

Received on Wednesday, 25 September 2013 13:52:41 UTC