mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Filter out buttons which aren't the submitter while constructing the dataset
This commit is contained in:
parent
749e2394c5
commit
d03120b3a4
1 changed files with 9 additions and 1 deletions
|
@ -222,7 +222,7 @@ impl<'a> HTMLFormElementHelpers for JSRef<'a, HTMLFormElement> {
|
||||||
script_chan.send(TriggerLoadMsg(win.page().id, load_data));
|
script_chan.send(TriggerLoadMsg(win.page().id, load_data));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_form_dataset(self, _submitter: Option<FormSubmitter>) -> Vec<FormDatum> {
|
fn get_form_dataset<'b>(self, submitter: Option<FormSubmitter<'b>>) -> Vec<FormDatum> {
|
||||||
fn clean_crlf(s: &str) -> DOMString {
|
fn clean_crlf(s: &str) -> DOMString {
|
||||||
// https://html.spec.whatwg.org/multipage/forms.html#constructing-the-form-data-set
|
// https://html.spec.whatwg.org/multipage/forms.html#constructing-the-form-data-set
|
||||||
// Step 4
|
// Step 4
|
||||||
|
@ -286,6 +286,12 @@ impl<'a> HTMLFormElementHelpers for JSRef<'a, HTMLFormElement> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut value = input.Value();
|
let mut value = input.Value();
|
||||||
|
let is_submitter = match submitter {
|
||||||
|
Some(InputElement(s)) => {
|
||||||
|
input == s
|
||||||
|
},
|
||||||
|
_ => false
|
||||||
|
};
|
||||||
match ty.as_slice() {
|
match ty.as_slice() {
|
||||||
"image" => None, // Unimplemented
|
"image" => None, // Unimplemented
|
||||||
"radio" | "checkbox" => {
|
"radio" | "checkbox" => {
|
||||||
|
@ -298,6 +304,8 @@ impl<'a> HTMLFormElementHelpers for JSRef<'a, HTMLFormElement> {
|
||||||
value: value
|
value: value
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// Discard buttons which are not the submitter
|
||||||
|
"submit" | "button" | "reset" if !is_submitter => None,
|
||||||
"file" => None, // Unimplemented
|
"file" => None, // Unimplemented
|
||||||
_ => Some(FormDatum {
|
_ => Some(FormDatum {
|
||||||
ty: ty,
|
ty: ty,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue