aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlelement.rs
diff options
context:
space:
mode:
authorEduard Burtescu <edy.burt@gmail.com>2014-12-11 04:57:42 +0200
committerEduard Burtescu <edy.burt@gmail.com>2014-12-19 06:29:04 +0200
commit5059a1b2acb9a130a67cd98138216504f25461a6 (patch)
tree9ec05c3649c72be8141b7244d584ada7cb696662 /components/script/dom/htmlelement.rs
parent9aaae08c3666d13ab608999e1dca587656e7b228 (diff)
downloadservo-5059a1b2acb9a130a67cd98138216504f25461a6.tar.gz
servo-5059a1b2acb9a130a67cd98138216504f25461a6.zip
Handle getting/setting onload for any element.
Diffstat (limited to 'components/script/dom/htmlelement.rs')
-rw-r--r--components/script/dom/htmlelement.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs
index 8fb0f2c4be5..e38ab5ff523 100644
--- a/components/script/dom/htmlelement.rs
+++ b/components/script/dom/htmlelement.rs
@@ -94,7 +94,8 @@ impl<'a> HTMLElementMethods for JSRef<'a, HTMLElement> {
let win = window_from_node(self).root();
win.GetOnload()
} else {
- None
+ let target: JSRef<EventTarget> = EventTargetCast::from_ref(self);
+ target.get_event_handler_common("load")
}
}
@@ -102,6 +103,9 @@ impl<'a> HTMLElementMethods for JSRef<'a, HTMLElement> {
if self.is_body_or_frameset() {
let win = window_from_node(self).root();
win.SetOnload(listener)
+ } else {
+ let target: JSRef<EventTarget> = EventTargetCast::from_ref(self);
+ target.set_event_handler_common("load", listener)
}
}