W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2013

Using arrays in platform APIs

From: Anne van Kesteren <annevk@annevk.nl>
Date: Wed, 25 Sep 2013 09:52:14 -0400
Message-ID: <CADnb78jYCMCyiWkQp0kWjgOR9aC+9SoNoJgBgXJF=XmTzQJvOg@mail.gmail.com>
To: "allen@wirfs-brock.com" <allen@wirfs-brock.com>, "public-script-coord@w3.org" <public-script-coord@w3.org>, Domenic Denicola <domenic@domenicdenicola.com>
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.

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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:18 UTC