Address review comments

This commit is contained in:
Manish Goregaokar 2014-10-08 03:18:45 +05:30
parent 3a1f9bd7fb
commit 1484acb7af
9 changed files with 38 additions and 45 deletions

View file

@ -11,7 +11,7 @@ use dom::document::Document;
use dom::element::{Element, AttributeHandlers, HTMLFormElementTypeId};
use dom::eventtarget::{EventTarget, NodeTargetTypeId};
use dom::htmlelement::HTMLElement;
use dom::node::{Node, ElementNodeTypeId};
use dom::node::{Node, ElementNodeTypeId, window_from_node};
use servo_util::str::DOMString;
use std::ascii::OwnedStrAsciiExt;
@ -50,7 +50,17 @@ impl<'a> HTMLFormElementMethods for JSRef<'a, HTMLFormElement> {
make_setter!(SetAcceptCharset, "accept-charset")
// https://html.spec.whatwg.org/multipage/forms.html#dom-fs-action
make_url_getter!(Action)
fn Action(self) -> DOMString {
let element: JSRef<Element> = ElementCast::from_ref(self);
let url = element.get_url_attribute("src");
match url.as_slice() {
"" => {
let window = window_from_node(self).root();
window.get_url().serialize()
},
_ => url
}
}
// https://html.spec.whatwg.org/multipage/forms.html#dom-fs-action
make_setter!(SetAction, "action")
@ -126,6 +136,7 @@ impl<'a> HTMLFormElementMethods for JSRef<'a, HTMLFormElement> {
// https://html.spec.whatwg.org/multipage/forms.html#dom-fs-target
make_setter!(SetTarget, "target")
}
impl Reflectable for HTMLFormElement {
fn reflector<'a>(&'a self) -> &'a Reflector {
self.htmlelement.reflector()