From d9b805324518ab03aee5fcf516f43c026153061a Mon Sep 17 00:00:00 2001 From: Marijn Kruisselbrink Date: Thu, 10 Oct 2024 11:23:45 -0700 Subject: [PATCH] Add FileList interface to HTML. This interface really only exists for usage by DataTransfer and , and its interface is driven by how it is (or should be used) by those. As such, it makes more sense to be part of HTML rather than FileAPI, as discussed at TPAC. --- source | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/source b/source index fd018b599ac..e582316ad7a 100644 --- a/source +++ b/source @@ -83918,6 +83918,61 @@ callback FunctionObjectCallback = undefined (any data);--> +

The FileList interface

+ +

This interface is a list of File objects.

+ +
[Exposed=(Window,Worker), Serializable]
+interface FileList {
+  getter File? item(unsigned long index);
+  readonly attribute unsigned long length;
+};
+  
+ +
+ +

A FileList object has an associated files list, which is a + list of File objects.

+ +

FileList objects are serializable objects.

+ +

Their serialization steps, given value and serialized, + are:

+ +
    +
  1. Set serialized.[[Files]] to an empty list.

    + +
  2. For each file in value, append + the sub-serialization of file to serialized.[[Files]].

  3. +
+ +

Their deserialization steps, given serialized and value, + are:

+ +
    +
  1. For each file of + serialized.[[Files]], add the sub-deserialization of file to + value.

  2. +
+ +

The length + attribute must return the size of this's files + list.

+ +

The item(index) method must run the following + steps:

+ +
    +
  1. Let files be this's files list.

  2. + +
  3. If index is greater than or equal to the size + of files, return null.

  4. + +
  5. Return files[index].

  6. +
+ +

The DragEvent interface