Auto merge of #8245 - eefriedman:misc-attribute-fixes, r=nox

Use attribute getter/setter macros for misc DOM attributes.

This fixes a few minor bugs.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8245)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-11-02 15:14:32 +05:30
commit 50d51bab7f
8 changed files with 213 additions and 67 deletions

View file

@ -83,15 +83,7 @@ impl HTMLButtonElementMethods for HTMLButtonElement {
}
// https://html.spec.whatwg.org/multipage/#dom-button-type
fn Type(&self) -> DOMString {
let mut ty = self.upcast::<Element>().get_string_attribute(&atom!("type"));
ty.make_ascii_lowercase();
// https://html.spec.whatwg.org/multipage/#attr-button-type
match &*ty {
"reset" | "button" | "menu" => ty,
_ => "submit".to_owned()
}
}
make_enumerated_getter!(Type, "submit", ("reset") | ("button") | ("menu"));
// https://html.spec.whatwg.org/multipage/#dom-button-type
make_setter!(SetType, "type");