mirror of
https://github.com/servo/servo.git
synced 2025-08-02 12:10:29 +01:00
Handle getting/setting onload for any element.
This commit is contained in:
parent
9aaae08c36
commit
5059a1b2ac
1 changed files with 5 additions and 1 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue