diff options
author | Josh Matthews <josh@joshmatthews.net> | 2014-04-10 21:29:54 -0400 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2014-05-03 14:18:30 -0400 |
commit | 76783b029e5e10da7fd61ab356a8f80a1eaf32e0 (patch) | |
tree | 93697ff8906d2661434abc660ae57607b1871b59 /src/components/script/dom/htmlscriptelement.rs | |
parent | dfdda0098a3f169a37c100b36d4dd36ec1d815aa (diff) | |
download | servo-76783b029e5e10da7fd61ab356a8f80a1eaf32e0.tar.gz servo-76783b029e5e10da7fd61ab356a8f80a1eaf32e0.zip |
Move WebIDL methods to traits implemented by JSRef types.
Diffstat (limited to 'src/components/script/dom/htmlscriptelement.rs')
-rw-r--r-- | src/components/script/dom/htmlscriptelement.rs | 60 |
1 files changed, 41 insertions, 19 deletions
diff --git a/src/components/script/dom/htmlscriptelement.rs b/src/components/script/dom/htmlscriptelement.rs index 808b05a12cf..fabe876a10f 100644 --- a/src/components/script/dom/htmlscriptelement.rs +++ b/src/components/script/dom/htmlscriptelement.rs @@ -41,77 +41,99 @@ impl HTMLScriptElement { } } -impl HTMLScriptElement { - pub fn Src(&self, abstract_self: &JSRef<HTMLScriptElement>) -> DOMString { +pub trait HTMLScriptElementMethods { + fn Src(&self, abstract_self: &JSRef<HTMLScriptElement>) -> DOMString; + fn SetSrc(&mut self, _abstract_self: &JSRef<HTMLScriptElement>, _src: DOMString) -> ErrorResult; + fn Type(&self) -> DOMString; + fn SetType(&mut self, _type: DOMString) -> ErrorResult; + fn Charset(&self) -> DOMString; + fn SetCharset(&mut self, _charset: DOMString) -> ErrorResult; + fn Async(&self) -> bool; + fn SetAsync(&self, _async: bool) -> ErrorResult; + fn Defer(&self) -> bool; + fn SetDefer(&self, _defer: bool) -> ErrorResult; + fn CrossOrigin(&self) -> DOMString; + fn SetCrossOrigin(&mut self, _cross_origin: DOMString) -> ErrorResult; + fn Text(&self) -> DOMString; + fn SetText(&mut self, _text: DOMString) -> ErrorResult; + fn Event(&self) -> DOMString; + fn SetEvent(&mut self, _event: DOMString) -> ErrorResult; + fn HtmlFor(&self) -> DOMString; + fn SetHtmlFor(&mut self, _html_for: DOMString) -> ErrorResult; +} + +impl<'a> HTMLScriptElementMethods for JSRef<'a, HTMLScriptElement> { + fn Src(&self, abstract_self: &JSRef<HTMLScriptElement>) -> DOMString { let element: &JSRef<Element> = ElementCast::from_ref(abstract_self); element.get_url_attribute("src") } - pub fn SetSrc(&mut self, _abstract_self: &JSRef<HTMLScriptElement>, _src: DOMString) -> ErrorResult { + fn SetSrc(&mut self, _abstract_self: &JSRef<HTMLScriptElement>, _src: DOMString) -> ErrorResult { Ok(()) } - pub fn Type(&self) -> DOMString { + fn Type(&self) -> DOMString { ~"" } - pub fn SetType(&mut self, _type: DOMString) -> ErrorResult { + fn SetType(&mut self, _type: DOMString) -> ErrorResult { Ok(()) } - pub fn Charset(&self) -> DOMString { + fn Charset(&self) -> DOMString { ~"" } - pub fn SetCharset(&mut self, _charset: DOMString) -> ErrorResult { + fn SetCharset(&mut self, _charset: DOMString) -> ErrorResult { Ok(()) } - pub fn Async(&self) -> bool { + fn Async(&self) -> bool { false } - pub fn SetAsync(&self, _async: bool) -> ErrorResult { + fn SetAsync(&self, _async: bool) -> ErrorResult { Ok(()) } - pub fn Defer(&self) -> bool { + fn Defer(&self) -> bool { false } - pub fn SetDefer(&self, _defer: bool) -> ErrorResult { + fn SetDefer(&self, _defer: bool) -> ErrorResult { Ok(()) } - pub fn CrossOrigin(&self) -> DOMString { + fn CrossOrigin(&self) -> DOMString { ~"" } - pub fn SetCrossOrigin(&mut self, _cross_origin: DOMString) -> ErrorResult { + fn SetCrossOrigin(&mut self, _cross_origin: DOMString) -> ErrorResult { Ok(()) } - pub fn Text(&self) -> DOMString { + fn Text(&self) -> DOMString { ~"" } - pub fn SetText(&mut self, _text: DOMString) -> ErrorResult { + fn SetText(&mut self, _text: DOMString) -> ErrorResult { Ok(()) } - pub fn Event(&self) -> DOMString { + fn Event(&self) -> DOMString { ~"" } - pub fn SetEvent(&mut self, _event: DOMString) -> ErrorResult { + fn SetEvent(&mut self, _event: DOMString) -> ErrorResult { Ok(()) } - pub fn HtmlFor(&self) -> DOMString { + fn HtmlFor(&self) -> DOMString { ~"" } - pub fn SetHtmlFor(&mut self, _html_for: DOMString) -> ErrorResult { + fn SetHtmlFor(&mut self, _html_for: DOMString) -> ErrorResult { Ok(()) } } + |