Use attribute getter/setter macros for misc DOM attributes.

This fixes a few minor bugs.

Also adds some better testing for "unsigned long" attributes.
This commit is contained in:
Eli Friedman 2015-11-01 12:47:28 -08:00
parent 285e29c066
commit cf8f2b1874
9 changed files with 214 additions and 67 deletions

View file

@ -81,15 +81,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");