aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlelement.rs
diff options
context:
space:
mode:
authorJoão Oliveira <hello@jxs.pt>2015-12-17 16:33:46 +0000
committerJosh Matthews <josh@joshmatthews.net>2016-02-26 10:17:57 -0500
commitb60d6689088ffca2a79467bbc0191961d6549cb7 (patch)
tree04a7904680475052848f6568171d5a6ea533471f /components/script/dom/htmlelement.rs
parentaaad24c5312367921c0d2eab117c3fa587018114 (diff)
downloadservo-b60d6689088ffca2a79467bbc0191961d6549cb7.tar.gz
servo-b60d6689088ffca2a79467bbc0191961d6549cb7.zip
use return value of invoking event handlers to cancel the event
Diffstat (limited to 'components/script/dom/htmlelement.rs')
-rw-r--r--components/script/dom/htmlelement.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs
index 70e370a8c8a..7c37c3ca9e2 100644
--- a/components/script/dom/htmlelement.rs
+++ b/components/script/dom/htmlelement.rs
@@ -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>() {