-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
mkruisselbrink
wants to merge
1
commit into
whatwg:main
Choose a base branch
from
mkruisselbrink:add-filelist
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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> | ||
|
||
<li><p><span data-x="list iterate">For each</span> <var>file</var> in <var>value</var>, append | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.