@@ -73,7 +73,6 @@ impl DomBackendOptions {
7373///
7474/// In other words, it transforms the [`Cell`]s into `<span>`s which are then
7575/// appended to a `<pre>` element.
76- #[ derive( Debug ) ]
7776pub struct DomBackend {
7877 /// Whether the backend has been initialized.
7978 initialized : Rc < RefCell < bool > > ,
@@ -199,12 +198,13 @@ impl DomBackend {
199198 let grid_rect = ( rect. left ( ) , rect. top ( ) , rect. width ( ) , rect. height ( ) ) ;
200199 handler. call ( MouseEvent :: new_relative ( event, cell_size_px, grid_rect) ) ;
201200 } else {
202- // Fallback to viewport-relative coordinates if we can't get the element
203- handler. call ( MouseEvent :: new ( event, cell_size_px) ) ;
201+ // this will maybe not happen, but if it does, we panic in dev
202+ // but ignore it in release builds. to be fixed if it happens.
203+ debug_assert ! ( false , "target is no longer a valid element" ) ;
204204 }
205205 } else {
206- // Fallback to viewport-relative coordinates if no target
207- handler . call ( MouseEvent :: new ( event , cell_size_px ) ) ;
206+ // same as above, this will maybe not happen, but if it does, we should fix it
207+ debug_assert ! ( false , "no current target for mouse event" ) ;
208208 }
209209 } ) as Box < dyn FnMut ( web_sys:: MouseEvent ) > ) ;
210210
0 commit comments