mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +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;
|
use dom::virtualmethods::vtable_for;
|
||||||
|
|
||||||
fn dispatch_to_listeners(event: &Event, target: &EventTarget, chain: &[&EventTarget]) {
|
fn dispatch_to_listeners(event: &Event, target: &EventTarget, chain: &[&EventTarget]) {
|
||||||
|
assert!(!event.stop_propagation());
|
||||||
|
assert!(!event.stop_immediate());
|
||||||
|
|
||||||
let type_ = event.Type();
|
let type_ = event.Type();
|
||||||
|
|
||||||
/* capturing */
|
/* capturing */
|
||||||
|
@ -98,6 +101,11 @@ pub fn dispatch_event(target: &EventTarget, pseudo_target: Option<&EventTarget>,
|
||||||
Some(pseudo_target) => pseudo_target,
|
Some(pseudo_target) => pseudo_target,
|
||||||
None => target.clone(),
|
None => target.clone(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if event.stop_propagation() {
|
||||||
|
return !event.DefaultPrevented();
|
||||||
|
}
|
||||||
|
|
||||||
event.set_dispatching(true);
|
event.set_dispatching(true);
|
||||||
|
|
||||||
//TODO: no chain if not participating in a tree
|
//TODO: no chain if not participating in a tree
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[stopPropagation.dispatchEvent.html]
|
|
||||||
type: testharness
|
|
||||||
[Test Description: If Event.stopPropagation() has been called prior to the dispatch, all phases must be skipped.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[stopPropagation.dispatchEvent.html]
|
|
||||||
type: testharness
|
|
||||||
[Test Description: If Event.stopPropagation() has been called prior to the dispatch, all phases must be skipped.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue