diff options
author | yodalee <lc85301@gmail.com> | 2015-01-28 03:36:09 +0800 |
---|---|---|
committer | yodalee <lc85301@gmail.com> | 2015-02-03 20:37:06 +0800 |
commit | 0f2b1c4856036b477480a282d1246bbeefd70cdb (patch) | |
tree | 9d5368ba944b3c2252bb0ead1a6fc854dd818c19 /components/script/dom/htmlformelement.rs | |
parent | 15231db7d325007cdd2a20236830f04478fff50d (diff) | |
download | servo-0f2b1c4856036b477480a282d1246bbeefd70cdb.tar.gz servo-0f2b1c4856036b477480a282d1246bbeefd70cdb.zip |
activation behavior for Button type Submit
Diffstat (limited to 'components/script/dom/htmlformelement.rs')
-rw-r--r-- | components/script/dom/htmlformelement.rs | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index bf6fe0d1c5f..be296d04c15 100644 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -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()) } } } |