aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlformelement.rs
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2014-10-11 19:28:54 +0530
committerManish Goregaokar <manishsmail@gmail.com>2014-10-14 21:24:36 +0530
commitd03120b3a480224d9553e9e229788cf990e9cf77 (patch)
tree3618b01ef9c9952593ea99c26c484188cadeb344 /components/script/dom/htmlformelement.rs
parent749e2394c5c8286734e1dd09312da5c33a7dcde4 (diff)
downloadservo-d03120b3a480224d9553e9e229788cf990e9cf77.tar.gz
servo-d03120b3a480224d9553e9e229788cf990e9cf77.zip
Filter out buttons which aren't the submitter while constructing the dataset
Diffstat (limited to 'components/script/dom/htmlformelement.rs')
-rw-r--r--components/script/dom/htmlformelement.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs
index 678a090e69b..813dc8beb95 100644
--- a/components/script/dom/htmlformelement.rs
+++ b/components/script/dom/htmlformelement.rs
@@ -222,7 +222,7 @@ impl<'a> HTMLFormElementHelpers for JSRef<'a, HTMLFormElement> {
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 {
// https://html.spec.whatwg.org/multipage/forms.html#constructing-the-form-data-set
// Step 4
@@ -286,6 +286,12 @@ impl<'a> HTMLFormElementHelpers for JSRef<'a, HTMLFormElement> {
}
let mut value = input.Value();
+ let is_submitter = match submitter {
+ Some(InputElement(s)) => {
+ input == s
+ },
+ _ => false
+ };
match ty.as_slice() {
"image" => None, // Unimplemented
"radio" | "checkbox" => {
@@ -298,6 +304,8 @@ impl<'a> HTMLFormElementHelpers for JSRef<'a, HTMLFormElement> {
value: value
})
},
+ // Discard buttons which are not the submitter
+ "submit" | "button" | "reset" if !is_submitter => None,
"file" => None, // Unimplemented
_ => Some(FormDatum {
ty: ty,