Skip to content

Commit

Permalink
Handle getting/setting onload for any element.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed Dec 19, 2014
1 parent 9aaae08 commit 5059a1b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion components/script/dom/htmlelement.rs
Expand Up @@ -94,14 +94,18 @@ 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")
}
}

fn SetOnload(self, listener: Option<EventHandlerNonNull>) {
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)
}
}

Expand Down

0 comments on commit 5059a1b

Please sign in to comment.