Skip to content

Commit 5dc7db2

Browse files
authored
Make <input type=file>.files settable
Tests: web-platform-tests/wpt#6617. Fixes whatwg#2861.
1 parent 5ead2c6 commit 5dc7db2

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed

source

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43257,7 +43257,7 @@ interface <dfn>HTMLInputElement</dfn> : <span>HTMLElement</span> {
4325743257
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-input-dirName">dirName</span>;
4325843258
[<span>CEReactions</span>] attribute boolean <span data-x="dom-fe-disabled">disabled</span>;
4325943259
readonly attribute <span>HTMLFormElement</span>? <span data-x="dom-fae-form">form</span>;
43260-
readonly attribute <span>FileList</span>? <span data-x="dom-input-files">files</span>;
43260+
attribute <span>FileList</span>? <span data-x="dom-input-files">files</span>;
4326143261
[<span>CEReactions</span>] attribute USVString <span data-x="dom-fs-formAction">formAction</span>;
4326243262
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-fs-formEnctype">formEnctype</span>;
4326343263
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-fs-formMethod">formMethod</span>;
@@ -48953,7 +48953,7 @@ You cannot submit this form when the field is incorrect.</samp></pre>
4895348953

4895448954
</dd>
4895548955

48956-
<dt><var>input</var> . <code subdfn data-x="dom-input-files">files</code> <!-- [ = <var>files</var> ] --></dt>
48956+
<dt><var>input</var> . <code subdfn data-x="dom-input-files">files</code> [ = <var>files</var> ]</dt>
4895748957

4895848958
<dd>
4895948959

@@ -48962,9 +48962,9 @@ You cannot submit this form when the field is incorrect.</samp></pre>
4896248962

4896348963
<p>Returns null if the control isn't a file control.</p>
4896448964

48965-
<!--
48966-
<p>Can be set to an array of <code>File</code> or <code>Blob</code> instances.</p>-
48967-
-->
48965+
<p>Can be set to a <code>FileList</code> object to change the <span
48966+
data-x="concept-input-type-file-selected">selected files</span> of the form control. For
48967+
instance, as the result of a drag-and-drop operation.</p>
4896848968

4896948969
</dd>
4897048970

@@ -49118,13 +49118,26 @@ You cannot submit this form when the field is incorrect.</samp></pre>
4911849118
<hr>
4911949119

4912049120
<p>The <dfn><code data-x="dom-input-files">files</code></dfn> IDL attribute allows scripts to
49121-
access the element's <span data-x="concept-input-type-file-selected">selected files</span>. On
49122-
getting, if the IDL attribute <span data-x="concept-input-apply">applies</span>, it must return a
49123-
<code>FileList</code> object that represents the current <span
49121+
access the element's <span data-x="concept-input-type-file-selected">selected files</span>.
49122+
49123+
<p>On getting, if the IDL attribute <span data-x="concept-input-apply">applies</span>, it must
49124+
return a <code>FileList</code> object that represents the current <span
4912449125
data-x="concept-input-type-file-selected">selected files</span>. The same object must be returned
49125-
until the list of <span data-x="concept-input-type-file-selected">selected files</span> changes. If
49126-
the IDL attribute <span data-x="do not apply">does not apply</span>, then it must instead return
49127-
null. <ref spec=FILEAPI></p>
49126+
until the list of <span data-x="concept-input-type-file-selected">selected files</span> changes.
49127+
If the IDL attribute <span data-x="do not apply">does not apply</span>, then it must instead
49128+
return null. <ref spec=FILEAPI></p>
49129+
49130+
<p>On setting, it must run these steps:
49131+
49132+
<ol>
49133+
<li><p>If the IDL attribute <span data-x="do not apply">does not apply</span> or the given value
49134+
is null, then return.</p></li>
49135+
<!-- This is inconsistent with other attributes, but Chrome and Safari already shipped so doesn't
49136+
seem worth the churn. -->
49137+
49138+
<li><p>Replace the element's <span data-x="concept-input-type-file-selected">selected
49139+
files</span> with the given value.</p></li>
49140+
</ol>
4912849141

4912949142
<hr>
4913049143

0 commit comments

Comments
 (0)