mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Avoid calling any listeners for events whose stop propagation flag is set prior to dispatching.
This commit is contained in:
parent
b342dff07d
commit
a5925020ce
3 changed files with 8 additions and 10 deletions
|
@ -13,6 +13,9 @@ use dom::node::Node;
|
|||
use dom::virtualmethods::vtable_for;
|
||||
|
||||
fn dispatch_to_listeners(event: &Event, target: &EventTarget, chain: &[&EventTarget]) {
|
||||
assert!(!event.stop_propagation());
|
||||
assert!(!event.stop_immediate());
|
||||
|
||||
let type_ = event.Type();
|
||||
|
||||
/* capturing */
|
||||
|
@ -98,6 +101,11 @@ pub fn dispatch_event(target: &EventTarget, pseudo_target: Option<&EventTarget>,
|
|||
Some(pseudo_target) => pseudo_target,
|
||||
None => target.clone(),
|
||||
});
|
||||
|
||||
if event.stop_propagation() {
|
||||
return !event.DefaultPrevented();
|
||||
}
|
||||
|
||||
event.set_dispatching(true);
|
||||
|
||||
//TODO: no chain if not participating in a tree
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue