Implement 'beforescriptexecute' and 'afterscriptexecute' events.

Spec: https://html.spec.whatwg.org/multipage/scripting.html#execute-the-script-block, sections 2.b.2 & 2.b.9
This commit is contained in:
James Gilbertson 2015-02-25 15:09:20 -07:00
parent 259792e481
commit 0b085df1bc
3 changed files with 55 additions and 29 deletions

View file

@ -246,7 +246,7 @@ impl<'a> EventMethods for JSRef<'a, Event> {
pub trait EventHelpers {
fn set_trusted(self, trusted: bool);
fn fire(self, target: JSRef<EventTarget>);
fn fire(self, target: JSRef<EventTarget>) -> bool;
}
impl<'a> EventHelpers for JSRef<'a, Event> {
@ -255,8 +255,8 @@ impl<'a> EventHelpers for JSRef<'a, Event> {
}
// https://html.spec.whatwg.org/multipage/webappapis.html#fire-a-simple-event
fn fire(self, target: JSRef<EventTarget>) {
fn fire(self, target: JSRef<EventTarget>) -> bool {
self.set_trusted(true);
target.dispatch_event(self);
target.dispatch_event(self)
}
}