diff --git a/src/platform_impl/web/web_sys/canvas.rs b/src/platform_impl/web/web_sys/canvas.rs index 25bc63a7..ea724822 100644 --- a/src/platform_impl/web/web_sys/canvas.rs +++ b/src/platform_impl/web/web_sys/canvas.rs @@ -378,16 +378,10 @@ impl Common { E: 'static + AsRef + wasm_bindgen::convert::FromWasmAbi, F: 'static + FnMut(E), { - let closure = Closure::wrap(Box::new(move |event: E| { - { - let event_ref = event.as_ref(); - event_ref.stop_propagation(); - event_ref.cancel_bubble(); - } - + let closure = Closure::new(move |event: E| { + event.as_ref().stop_propagation(); handler(event); - }) as Box); - + }); EventListenerHandle::new(&self.raw, event_name, closure) }