aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmllabelelement.rs
diff options
context:
space:
mode:
authorPhilipp Hartwig <ph@phhart.de>2015-09-27 19:08:53 +0200
committerPhilipp Hartwig <ph@phhart.de>2015-09-27 19:08:53 +0200
commit8d67914c7f33364435171c400698db998875595f (patch)
treec46d65cd9fab98a3e5c132f22588c14ef9aae428 /components/script/dom/htmllabelelement.rs
parenta1fb8cfbb0be8d0a73bc1e3b63eb704f48098b8f (diff)
downloadservo-8d67914c7f33364435171c400698db998875595f.tar.gz
servo-8d67914c7f33364435171c400698db998875595f.zip
Add form getters for additional elements; update test expectations
This adds form getters for fieldset, label, object, output, select and textarea elements.
Diffstat (limited to 'components/script/dom/htmllabelelement.rs')
-rw-r--r--components/script/dom/htmllabelelement.rs18
1 files changed, 17 insertions, 1 deletions
diff --git a/components/script/dom/htmllabelelement.rs b/components/script/dom/htmllabelelement.rs
index 5e7da7dfbff..ec3f1fa7865 100644
--- a/components/script/dom/htmllabelelement.rs
+++ b/components/script/dom/htmllabelelement.rs
@@ -3,12 +3,15 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::HTMLLabelElementBinding;
+use dom::bindings::codegen::Bindings::HTMLLabelElementBinding::HTMLLabelElementMethods;
+use dom::bindings::codegen::InheritTypes::ElementCast;
use dom::bindings::codegen::InheritTypes::HTMLLabelElementDerived;
use dom::bindings::js::Root;
use dom::document::Document;
-use dom::element::ElementTypeId;
+use dom::element::{Element, ElementTypeId};
use dom::eventtarget::{EventTarget, EventTargetTypeId};
use dom::htmlelement::{HTMLElement, HTMLElementTypeId};
+use dom::htmlformelement::{FormControl, HTMLFormElement};
use dom::node::{Node, NodeTypeId};
use util::str::DOMString;
@@ -43,3 +46,16 @@ impl HTMLLabelElement {
Node::reflect_node(box element, document, HTMLLabelElementBinding::Wrap)
}
}
+
+impl HTMLLabelElementMethods for HTMLLabelElement {
+ // https://html.spec.whatwg.org/multipage#dom-fae-form
+ fn GetForm(&self) -> Option<Root<HTMLFormElement>> {
+ self.form_owner()
+ }
+}
+
+impl<'a> FormControl<'a> for &'a HTMLLabelElement {
+ fn to_element(self) -> &'a Element {
+ ElementCast::from_ref(self)
+ }
+}