diff options
author | shanehandley <1322294+shanehandley@users.noreply.github.com> | 2024-04-01 20:12:07 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-01 09:12:07 +0000 |
commit | 8c1a72f13052ece57fcff4e424dbab58afa9b37e (patch) | |
tree | cd6aad477a3916ea09af571155925c0202fd6abc /components/script/dom | |
parent | 8c25336e9af0a1ca32107622d94993f9c834d46c (diff) | |
download | servo-8c1a72f13052ece57fcff4e424dbab58afa9b37e.tar.gz servo-8c1a72f13052ece57fcff4e424dbab58afa9b37e.zip |
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
Diffstat (limited to 'components/script/dom')
-rwxr-xr-x | components/script/dom/htmlinputelement.rs | 7 | ||||
-rw-r--r-- | components/script/dom/webidls/HTMLInputElement.webidl | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index b00d2079db6..5ebd9c2cdc0 100755 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -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"); diff --git a/components/script/dom/webidls/HTMLInputElement.webidl b/components/script/dom/webidls/HTMLInputElement.webidl index 160b3904439..519198cebd9 100644 --- a/components/script/dom/webidls/HTMLInputElement.webidl +++ b/components/script/dom/webidls/HTMLInputElement.webidl @@ -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] |