mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
activation behavior for Button type Submit
This commit is contained in:
parent
15231db7d3
commit
0f2b1c4856
2 changed files with 34 additions and 3 deletions
|
@ -8,6 +8,7 @@ use dom::bindings::codegen::Bindings::EventTargetBinding::EventTargetMethods;
|
|||
use dom::bindings::codegen::Bindings::HTMLFormElementBinding;
|
||||
use dom::bindings::codegen::Bindings::HTMLFormElementBinding::HTMLFormElementMethods;
|
||||
use dom::bindings::codegen::Bindings::HTMLInputElementBinding::HTMLInputElementMethods;
|
||||
use dom::bindings::codegen::Bindings::HTMLButtonElementBinding::HTMLButtonElementMethods;
|
||||
use dom::bindings::codegen::InheritTypes::{EventTargetCast, HTMLFormElementDerived, NodeCast};
|
||||
use dom::bindings::codegen::InheritTypes::{HTMLInputElementCast, HTMLTextAreaElementCast, HTMLFormElementCast};
|
||||
use dom::bindings::global::GlobalRef;
|
||||
|
@ -19,6 +20,7 @@ use dom::eventtarget::{EventTarget, EventTargetTypeId};
|
|||
use dom::element::ElementTypeId;
|
||||
use dom::htmlelement::{HTMLElement, HTMLElementTypeId};
|
||||
use dom::htmlinputelement::{HTMLInputElement, HTMLInputElementHelpers};
|
||||
use dom::htmlbuttonelement::{HTMLButtonElement};
|
||||
use dom::htmltextareaelement::{HTMLTextAreaElement, HTMLTextAreaElementHelpers};
|
||||
use dom::node::{Node, NodeHelpers, NodeTypeId, document_from_node, window_from_node};
|
||||
use hyper::method::Method;
|
||||
|
@ -416,8 +418,9 @@ pub enum FormMethod {
|
|||
#[derive(Copy)]
|
||||
pub enum FormSubmitter<'a> {
|
||||
FormElement(JSRef<'a, HTMLFormElement>),
|
||||
InputElement(JSRef<'a, HTMLInputElement>)
|
||||
// TODO: Submit buttons, image submit, etc etc
|
||||
InputElement(JSRef<'a, HTMLInputElement>),
|
||||
ButtonElement(JSRef<'a, HTMLButtonElement>)
|
||||
// TODO: image submit, etc etc
|
||||
}
|
||||
|
||||
impl<'a> FormSubmitter<'a> {
|
||||
|
@ -429,6 +432,11 @@ impl<'a> FormSubmitter<'a> {
|
|||
input_element.get_form_attribute(&Atom::from_slice("formaction"),
|
||||
|i| i.FormAction(),
|
||||
|f| f.Action())
|
||||
},
|
||||
FormSubmitter::ButtonElement(button_element) => {
|
||||
button_element.get_form_attribute(&Atom::from_slice("formaction"),
|
||||
|i| i.FormAction(),
|
||||
|f| f.Action())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -441,6 +449,11 @@ impl<'a> FormSubmitter<'a> {
|
|||
input_element.get_form_attribute(&Atom::from_slice("formenctype"),
|
||||
|i| i.FormEnctype(),
|
||||
|f| f.Enctype())
|
||||
},
|
||||
FormSubmitter::ButtonElement(button_element) => {
|
||||
button_element.get_form_attribute(&Atom::from_slice("formenctype"),
|
||||
|i| i.FormAction(),
|
||||
|f| f.Action())
|
||||
}
|
||||
};
|
||||
match attr.as_slice() {
|
||||
|
@ -460,6 +473,11 @@ impl<'a> FormSubmitter<'a> {
|
|||
input_element.get_form_attribute(&Atom::from_slice("formmethod"),
|
||||
|i| i.FormMethod(),
|
||||
|f| f.Method())
|
||||
},
|
||||
FormSubmitter::ButtonElement(button_element) => {
|
||||
button_element.get_form_attribute(&Atom::from_slice("formmethod"),
|
||||
|i| i.FormAction(),
|
||||
|f| f.Action())
|
||||
}
|
||||
};
|
||||
match attr.as_slice() {
|
||||
|
@ -477,6 +495,11 @@ impl<'a> FormSubmitter<'a> {
|
|||
input_element.get_form_attribute(&Atom::from_slice("formtarget"),
|
||||
|i| i.FormTarget(),
|
||||
|f| f.Target())
|
||||
},
|
||||
FormSubmitter::ButtonElement(button_element) => {
|
||||
button_element.get_form_attribute(&Atom::from_slice("formtarget"),
|
||||
|i| i.FormAction(),
|
||||
|f| f.Action())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue