Update webidl and implement setter for the files property of a file input (#31934)

The files attribute was previously readonly, but was later updated to allow mutation via input.files = ...

see https://github.com/whatwg/html/issues/2861
This commit is contained in:
shanehandley 2024-04-01 20:12:07 +11:00 committed by GitHub
parent 8c25336e9a
commit 8c1a72f130
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 8 additions and 13 deletions

View file

@ -1186,6 +1186,13 @@ impl HTMLInputElementMethods for HTMLInputElement {
self.filelist.get().as_ref().cloned()
}
/// <https://html.spec.whatwg.org/multipage/#dom-input-files>
fn SetFiles(&self, files: Option<&FileList>) {
if self.input_type() == InputType::File && files.is_some() {
self.filelist.set(files);
}
}
// https://html.spec.whatwg.org/multipage/#dom-input-defaultchecked
make_bool_getter!(DefaultChecked, "checked");

View file

@ -23,7 +23,7 @@ interface HTMLInputElement : HTMLElement {
[CEReactions]
attribute boolean disabled;
readonly attribute HTMLFormElement? form;
readonly attribute FileList? files;
attribute FileList? files;
[CEReactions]
attribute DOMString formAction;
[CEReactions]

View file

@ -3381,9 +3381,6 @@
[HTMLSlotElement interface: operation assignedElements(AssignedNodesOptions)]
expected: FAIL
[HTMLInputElement interface: attribute files]
expected: FAIL
[Stringification of document.all]
expected: FAIL

View file

@ -1,7 +1,4 @@
[files.html]
type: testharness
[setting <input type=file>.files]
expected: FAIL
[setting <input type=file>.files from DataTransfer]
expected: FAIL

View file

@ -3219,9 +3219,6 @@
[HTMLInputElement interface: createInput("image") must inherit property "width" with the proper type]
expected: FAIL
[HTMLInputElement interface: attribute files]
expected: FAIL
[Stringification of document.all]
expected: FAIL

View file

@ -1,7 +1,4 @@
[files.html]
type: testharness
[setting <input type=file>.files]
expected: FAIL
[setting <input type=file>.files from DataTransfer]
expected: FAIL