mirror of
https://github.com/servo/servo.git
synced 2025-07-21 22:33:41 +01:00
make the concept of has_listeners_for follow other implementations (#21044)
Co-authored-by: Gregory Terzian <gterzian@users.noreply.github.com>
This commit is contained in:
parent
4f4c2a5922
commit
cf9ec700de
3 changed files with 4 additions and 14 deletions
|
@ -138,18 +138,6 @@ impl Event {
|
|||
self.cancelable.set(cancelable);
|
||||
}
|
||||
|
||||
// Determine if there are any listeners for a given target and type.
|
||||
// See https://github.com/whatwg/dom/issues/453
|
||||
pub fn has_listeners_for(&self, target: &EventTarget, type_: &Atom) -> bool {
|
||||
// TODO: take 'removed' into account? Not implemented in Servo yet.
|
||||
// https://dom.spec.whatwg.org/#event-listener-removed
|
||||
let mut event_path = self.construct_event_path(&target);
|
||||
event_path.push(DomRoot::from_ref(target));
|
||||
event_path
|
||||
.iter()
|
||||
.any(|target| target.has_listeners_for(type_))
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#event-path
|
||||
// TODO: shadow roots put special flags in the path,
|
||||
// and it will stop just being a list of bare EventTargets
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue