Use an Atom for Event.type

This commit is contained in:
David Zbarsky 2015-10-25 10:29:33 -07:00
parent 601169c0e5
commit 0070adb71f
5 changed files with 27 additions and 21 deletions

View file

@ -607,7 +607,7 @@ impl VirtualMethods for HTMLInputElement {
s.handle_event(event);
}
if &*event.Type() == "click" && !event.DefaultPrevented() {
if event.type_() == atom!("click") && !event.DefaultPrevented() {
match self.input_type.get() {
InputType::InputRadio => self.update_checked_state(true, true),
_ => {}
@ -619,7 +619,7 @@ impl VirtualMethods for HTMLInputElement {
//TODO: set the editing position for text inputs
document_from_node(self).request_focus(self.upcast());
} else if &*event.Type() == "keydown" && !event.DefaultPrevented() &&
} else if event.type_() == atom!("keydown") && !event.DefaultPrevented() &&
(self.input_type.get() == InputType::InputText ||
self.input_type.get() == InputType::InputPassword) {
if let Some(keyevent) = event.downcast::<KeyboardEvent>() {