From d768ee77adab5e5f53b7fb978c07ddbb798e8954 Mon Sep 17 00:00:00 2001 From: Cameron Zwarich Date: Fri, 19 Sep 2014 19:57:50 -0700 Subject: Convert various helper traits from &JSRef to JSRef I converted them all with a few exceptions: - Methods that were used by trait objects, since trait objects don't work with `self` methods. - Methods that take an &'b JSRef<'a, T> and return an &'b. In reality, many (all?) could return an &'a instead, but this isn't allowed by the Deref trait. - Methods that internally rely on the same issue with Deref. - I left out the traits involved in layout entirely, even though not all of their methods suffer from one of the above problems. There will probably be solutions to all of these problems in the future. --- components/script/dom/htmlscriptelement.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'components/script/dom/htmlscriptelement.rs') diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs index d16fc56d72f..d733cbb45ea 100644 --- a/components/script/dom/htmlscriptelement.rs +++ b/components/script/dom/htmlscriptelement.rs @@ -48,7 +48,7 @@ impl HTMLScriptElement { pub trait HTMLScriptElementHelpers { /// Prepare a script (), /// steps 6 and 7. - fn is_javascript(&self) -> bool; + fn is_javascript(self) -> bool; } /// Supported script types as defined by @@ -73,8 +73,8 @@ static SCRIPT_JS_MIMES: StaticStringVec = &[ ]; impl<'a> HTMLScriptElementHelpers for JSRef<'a, HTMLScriptElement> { - fn is_javascript(&self) -> bool { - let element: JSRef = ElementCast::from_ref(*self); + fn is_javascript(self) -> bool { + let element: JSRef = ElementCast::from_ref(self); match element.get_attribute(Null, "type").root().map(|s| s.Value()) { Some(ref s) if s.is_empty() => { // type attr exists, but empty means js -- cgit v1.2.3