aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/htmlinputelement.rs14
-rw-r--r--components/script/dom/webidls/HTMLInputElement.webidl2
2 files changed, 15 insertions, 1 deletions
diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs
index 71edf5c7abb..6c3b008bfc8 100644
--- a/components/script/dom/htmlinputelement.rs
+++ b/components/script/dom/htmlinputelement.rs
@@ -302,6 +302,14 @@ impl HTMLInputElementMethods for HTMLInputElement {
self.form_owner()
}
+ // https://html.spec.whatwg.org/multipage/#dom-input-files
+ fn GetFiles(&self) -> Option<Root<FileList>> {
+ match self.filelist.get() {
+ Some(ref fl) => Some(fl.clone()),
+ None => None,
+ }
+ }
+
// https://html.spec.whatwg.org/multipage/#dom-input-defaultchecked
make_bool_getter!(DefaultChecked, "checked");
@@ -796,6 +804,12 @@ impl VirtualMethods for HTMLInputElement {
el.set_read_write_state(false);
}
+ if new_type == InputType::InputFile {
+ let window = window_from_node(self);
+ let filelist = FileList::new(window.r(), vec![]);
+ self.filelist.set(Some(&filelist));
+ }
+
let new_value_mode = self.value_mode();
match (&old_value_mode, old_idl_value.is_empty(), new_value_mode) {
diff --git a/components/script/dom/webidls/HTMLInputElement.webidl b/components/script/dom/webidls/HTMLInputElement.webidl
index 48ec3c0ac7b..d145e498659 100644
--- a/components/script/dom/webidls/HTMLInputElement.webidl
+++ b/components/script/dom/webidls/HTMLInputElement.webidl
@@ -13,7 +13,7 @@ interface HTMLInputElement : HTMLElement {
attribute DOMString dirName;
attribute boolean disabled;
readonly attribute HTMLFormElement? form;
- //readonly attribute FileList? files;
+ readonly attribute FileList? files;
attribute DOMString formAction;
attribute DOMString formEnctype;
attribute DOMString formMethod;