Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FileList interface to HTML. #10693

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -83918,6 +83918,61 @@ callback <dfn>FunctionObjectCallback</dfn> = undefined (any data);--></code></pr
</div>


<h4>The <code>FileList</code> interface</h4>

<p>This interface is a list of <code>File</code> objects.</p>

<pre><code class="idl">[Exposed=(Window,Worker), Serializable]
interface <dfn interface>FileList</dfn> {
getter File? <span data-x="dom-FileList-item">item</span>(unsigned long index);
readonly attribute unsigned long <span data-x="dom-FileList-length">length</span>;
};
</code></pre>

<div w-nodev>

<p>A <code>FileList</code> object has an associated <dfn>files list</dfn>, which is a
<span>list</span> of <code>File</code> objects.</p>

<p><code>FileList</code> objects are <span>serializable objects</span>.</p>

<p>Their <span>serialization steps</span>, given <var>value</var> and <var>serialized</var>,
are:</p>

<ol>
<li><p>Set <var>serialized</var>.[[Files]] to an empty <span>list</span>.</p>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: single-space indents, here and below.


<li><p><span data-x="list iterate">For each</span> <var>file</var> in <var>value</var>, append
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should loop through value's file list, here and below.

the <span>sub-serialization</span> of <var>file</var> to <var>serialized</var>.[[Files]].</p></li>
</ol>

<p>Their <span>deserialization steps</span>, given <var>serialized</var> and <var>value</var>,
are:</p>

<ol>
<li><p><span data-x="list iterate">For each</span> <var>file</var> of
<var>serialized</var>.[[Files]], add the <span>sub-deserialization</span> of <var>file</var> to
<var>value</var>.</p></li>
</ol>

<p>The <dfn attribute for="FileList"><code data-x="dom-FileList-length">length</code></dfn>
attribute must return the <span data-x="list size">size</span> of <span>this</span>'s <span>files
list</span>.</p>

<p>The <dfn method for="FileList"><code
data-x="dom-FileList-item">item(<var>index</var>)</code></dfn> method must run the following
steps:</p>

<ol>
<li><p>Let <var>files</var> be <span>this</span>'s <span>files list</span>.</p></li>

<li><p>If <var>index</var> is greater than or equal to the <span data-x="list size">size</span>
of <var>files</var>, return null.</p></li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: "then return null"


<li><p>Return <var>files</var>[<var>index</var>].</p></li>
</ol>

</div>

<h4>The <code>DragEvent</code> interface</h4>

Expand Down
Loading