javascriptsafari-web-inspector

In Safari web inspector, is it possible to stop on all events except specified events?


I have a webapp with an inner-pane inside an outer-window.
The user can zoom-in in the inner-pane via 2-finger pinch, without zooming-in the outer-window.

On Chrome on Android, the app works as expected.
But Safari on iOS device (iPad), zoomimg-in inside the inner pane, actually zooms-in the entire window, which is not the intended behaviour.

I read here that iphone/ipad can trigger unexpected events.

I want to find this event.
I remote-debug the webapp iOS Safari by connecting the iPad to a Macbook and debugging via Safari.

In Safari Web Inspector, Sources tab, Breakpoints section, I added All Events.
When I touch the pane, the code breaks as expected on the ontouchstart event, which is not the offending event.

I can add specific events to break on, by name.
But because I don't know which is the offending events, I want to break on all events except the ontouchstart event.

Is it possible to stop on all events in Safari except specified events?

Thanks


Solution

  • I did not find out if it is possible, to break on all events excluding specific event(s).

    I recently found this link which comprehensively explains various breakpoint options in Safari.
    The author of the link graciously answered my question:

    Currently there is no way to exclude specific events.  
    In your scenario, is it really necessary to add listeners for all events, or is it a known list of specific events (e.g. all touch and mouse)?  
    If it's the latter, I'd suggest just adding a global event listener breakpoint for each event other than the one event you want to exclude.  
    Another option might be to configure an All Events global event listener breakpoint with a condition of something like window.event.type !== "..."  
    (note that this will only work in Safari Technology Preview 114 or newer).  
    

    p.s.
    The reason for my question was an upstream offending event listener.
    Because the problem was in an event listener that is upstream to the target event, it wouldn't have helped to break on all events excluding specific event(s).
    I ended-up solving my original problem by applying addEventListener with passive = false, and using preventDefault() to prevent from triggering the upstream event handlers in the bubbling stage.