Return a Vec from EventTarget::get_listeners_for

This commit is contained in:
Anthony Ramine 2016-02-29 10:15:55 +01:00 committed by Ms2ger
parent 590316a468
commit fc2cf31d5a
2 changed files with 26 additions and 30 deletions

View file

@ -304,8 +304,8 @@ impl EventTarget {
pub fn get_listeners_for(&self,
type_: &Atom,
desired_phase: Option<ListenerPhase>)
-> Option<Vec<CompiledEventListener>> {
self.handlers.borrow_mut().get_mut(type_).map(|listeners| {
-> Vec<CompiledEventListener> {
self.handlers.borrow_mut().get_mut(type_).map_or(vec![], |listeners| {
listeners.get_listeners(desired_phase, self, type_)
})
}