diff options
author | Manish Goregaokar <manishsmail@gmail.com> | 2014-10-07 21:25:45 +0530 |
---|---|---|
committer | Manish Goregaokar <manishsmail@gmail.com> | 2014-10-07 22:22:48 +0530 |
commit | 8cba6c758098b295f7ccddfcb6fd82e6270e8342 (patch) | |
tree | bc112e39a065bf9eaa32945f84d2d4b23b074a51 /components/script/dom/htmlformelement.rs | |
parent | e9f654d60a9e5678d0078775dcc1125e2269c1f9 (diff) | |
download | servo-8cba6c758098b295f7ccddfcb6fd82e6270e8342.tar.gz servo-8cba6c758098b295f7ccddfcb6fd82e6270e8342.zip |
Add macro for reflecting URLs
Diffstat (limited to 'components/script/dom/htmlformelement.rs')
-rw-r--r-- | components/script/dom/htmlformelement.rs | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index bf2fd4f2de4..964b17e0784 100644 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -7,14 +7,13 @@ use dom::bindings::codegen::Bindings::HTMLFormElementBinding::HTMLFormElementMet use dom::bindings::codegen::InheritTypes::{ElementCast, HTMLFormElementDerived}; use dom::bindings::js::{JSRef, Temporary}; use dom::bindings::utils::{Reflectable, Reflector}; -use dom::document::{Document, DocumentHelpers}; +use dom::document::Document; use dom::element::{Element, AttributeHandlers, HTMLFormElementTypeId}; use dom::eventtarget::{EventTarget, NodeTargetTypeId}; use dom::htmlelement::HTMLElement; -use dom::node::{Node, ElementNodeTypeId, document_from_node}; +use dom::node::{Node, ElementNodeTypeId}; use servo_util::str::DOMString; use std::ascii::OwnedStrAsciiExt; -use url::UrlParser; #[jstraceable] @@ -51,17 +50,7 @@ impl<'a> HTMLFormElementMethods for JSRef<'a, HTMLFormElement> { make_setter!(SetAcceptCharset, "accept-charset") // https://html.spec.whatwg.org/multipage/forms.html#dom-fs-action - fn Action(self) -> DOMString { - let elem: JSRef<Element> = ElementCast::from_ref(self); - let action = elem.get_string_attribute("action"); - let doc = document_from_node(self).root(); - let base = doc.url(); - // https://html.spec.whatwg.org/multipage/infrastructure.html#reflect - match UrlParser::new().base_url(base).parse(action.as_slice()) { - Ok(parsed) => parsed.serialize(), - Err(_) => base.serialize() - } - } + make_url_getter!(Action) // https://html.spec.whatwg.org/multipage/forms.html#dom-fs-action make_setter!(SetAction, "action") |