diff options
author | Cameron Zwarich <zwarich@mozilla.com> | 2014-09-30 20:33:40 -0700 |
---|---|---|
committer | Cameron Zwarich <zwarich@mozilla.com> | 2014-09-30 21:21:00 -0700 |
commit | be9618d55bd48be45e55b2c49d0df12f953f1fe5 (patch) | |
tree | 450a7ad8157ad2425adc335707d77a2bfe6aadd3 /components/script/dom/element.rs | |
parent | 4ef0f39c7877ee98c0d7fe826badd63e2bb97d6d (diff) | |
download | servo-be9618d55bd48be45e55b2c49d0df12f953f1fe5.tar.gz servo-be9618d55bd48be45e55b2c49d0df12f953f1fe5.zip |
Add a lifetime parameter to the ElementHelper trait
This refines the lifetime used in get_local_name / get_namespace and
makes it independent of the lifetime on the &self parameter.
Diffstat (limited to 'components/script/dom/element.rs')
-rw-r--r-- | components/script/dom/element.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index c734ad89161..821ac1f9909 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -237,26 +237,26 @@ impl LayoutElementHelpers for JS<Element> { } } -pub trait ElementHelpers { +pub trait ElementHelpers<'a> { fn html_element_in_html_document(self) -> bool; - fn get_local_name<'a>(&'a self) -> &'a Atom; - fn get_namespace<'a>(&'a self) -> &'a Namespace; + fn get_local_name(&self) -> &'a Atom; + fn get_namespace(&self) -> &'a Namespace; fn summarize(self) -> Vec<AttrInfo>; fn is_void(self) -> bool; } -impl<'a> ElementHelpers for JSRef<'a, Element> { +impl<'a> ElementHelpers<'a> for JSRef<'a, Element> { fn html_element_in_html_document(self) -> bool { let node: JSRef<Node> = NodeCast::from_ref(self); self.namespace == ns!(HTML) && node.is_in_html_doc() } - fn get_local_name<'a>(&'a self) -> &'a Atom { - &self.deref().local_name + fn get_local_name(&self) -> &'a Atom { + &self.extended_deref().local_name } - fn get_namespace<'a>(&'a self) -> &'a Namespace { - &self.deref().namespace + fn get_namespace(&self) -> &'a Namespace { + &self.extended_deref().namespace } fn summarize(self) -> Vec<AttrInfo> { |