Fix step 10 of eventdispatcher::dispatch_event (fixes #11609)

We consolidate steps 10-12 in a single function to expose less general-purpose
mutating methods on Event.
This commit is contained in:
Anthony Ramine 2016-08-24 13:45:34 +02:00
parent 9d32088116
commit 540fe15f17
3 changed files with 19 additions and 21 deletions

View file

@ -123,7 +123,7 @@ pub fn dispatch_event(target: &EventTarget,
}
// Step 1. Postponed here for the reason stated above.
event.set_dispatching(true);
event.mark_as_dispatching();
// Step 3. The "invoke" algorithm is only used on `target` separately,
// so we don't put it in the path.
@ -158,14 +158,8 @@ pub fn dispatch_event(target: &EventTarget,
None => {}
}
// Step 10.
event.set_dispatching(false);
// Step 11.
event.set_phase(EventPhase::None);
// Step 12.
event.clear_current_target();
// Step 10-12.
event.clear_dispatching_flags();
// Step 13.
!event.DefaultPrevented()