use return value of invoking event handlers to cancel the event

This commit is contained in:
João Oliveira 2015-12-17 16:33:46 +00:00 committed by Josh Matthews
parent aaad24c531
commit b60d668908
9 changed files with 141 additions and 58 deletions

View file

@ -180,6 +180,24 @@ impl HTMLElementMethods for HTMLElement {
}
}
// https://html.spec.whatwg.org/multipage/#handler-onblur
fn GetOnblur(&self) -> Option<Rc<EventHandlerNonNull>> {
if self.is_body_or_frameset() {
window_from_node(self).GetOnblur()
} else {
self.upcast::<EventTarget>().get_event_handler_common("blur")
}
}
// https://html.spec.whatwg.org/multipage/#handler-onblur
fn SetOnblur(&self, listener: Option<Rc<EventHandlerNonNull>>) {
if self.is_body_or_frameset() {
window_from_node(self).SetOnblur(listener)
} else {
self.upcast::<EventTarget>().set_event_handler_common("blur", listener)
}
}
// https://html.spec.whatwg.org/multipage/#dom-click
fn Click(&self) {
if let Some(i) = self.downcast::<HTMLInputElement>() {