aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlformelement.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/htmlformelement.rs')
-rw-r--r--components/script/dom/htmlformelement.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs
index b16b2ec5609..0d9e0176d0e 100644
--- a/components/script/dom/htmlformelement.rs
+++ b/components/script/dom/htmlformelement.rs
@@ -9,6 +9,7 @@ use dom::bindings::codegen::Bindings::HTMLButtonElementBinding::HTMLButtonElemen
use dom::bindings::codegen::Bindings::HTMLFormElementBinding;
use dom::bindings::codegen::Bindings::HTMLFormElementBinding::HTMLFormElementMethods;
use dom::bindings::codegen::Bindings::HTMLInputElementBinding::HTMLInputElementMethods;
+use dom::bindings::codegen::InheritTypes::{ElementBase, ElementCast};
use dom::bindings::codegen::InheritTypes::EventTargetCast;
use dom::bindings::codegen::InheritTypes::HTMLDataListElementCast;
use dom::bindings::codegen::InheritTypes::HTMLElementCast;
@@ -18,6 +19,7 @@ use dom::bindings::codegen::InheritTypes::HTMLInputElementCast;
use dom::bindings::codegen::InheritTypes::{HTMLTextAreaElementCast, NodeCast};
use dom::bindings::global::GlobalRef;
use dom::bindings::js::{Root};
+use dom::bindings::utils::Reflectable;
use dom::document::Document;
use dom::element::{Element, ElementTypeId};
use dom::event::{Event, EventBubbles, EventCancelable};
@@ -515,10 +517,10 @@ impl<'a> FormSubmitter<'a> {
}
}
-pub trait FormControl<'a> : Copy + Sized {
+pub trait FormControl: ElementBase + Reflectable {
// FIXME: This is wrong (https://github.com/servo/servo/issues/3553)
// but we need html5ever to do it correctly
- fn form_owner(self) -> Option<Root<HTMLFormElement>> {
+ fn form_owner(&self) -> Option<Root<HTMLFormElement>> {
// https://html.spec.whatwg.org/multipage/#reset-the-form-owner
let elem = self.to_element();
let owner = elem.get_string_attribute(&atom!("form"));
@@ -544,12 +546,12 @@ pub trait FormControl<'a> : Copy + Sized {
None
}
- fn get_form_attribute<InputFn, OwnerFn>(self,
+ fn get_form_attribute<InputFn, OwnerFn>(&self,
attr: &Atom,
input: InputFn,
owner: OwnerFn)
-> DOMString
- where InputFn: Fn(Self) -> DOMString,
+ where InputFn: Fn(&Self) -> DOMString,
OwnerFn: Fn(&HTMLFormElement) -> DOMString
{
if self.to_element().has_attribute(attr) {
@@ -559,7 +561,9 @@ pub trait FormControl<'a> : Copy + Sized {
}
}
- fn to_element(self) -> &'a Element;
+ fn to_element(&self) -> &Element {
+ ElementCast::from_ref(self)
+ }
}
impl VirtualMethods for HTMLFormElement {