Is it possible with Firebug to stop a javascript with a press of a button or a keyboard shortcut instead of stopping it by setting a breakpoint?
Why would I like to do this? We have a very dynamic website with lots of animations. It would be a great help if I could just stop the scripts at the moment the animation is doing something I want to inspect. That would be a lot faster than fiddling with the breakpoints.
This is how I did it, from the web console (not the scratchpad), run:
window.addEventListener("keydown", function() {debugger;})
Then go back to the debugger tab. When you focus the document and press a key, the browser will pause JS.
There is a pause button in Firebug. Clicking on that is what you are looking for.
Firebug has different ways to stop the script execution without setting breakpoints at specific lines. These options are called Break On features.
In your case I see two relevant options:
Break the JavaScript on the next executed line
The Script panel has a Break On Next button (), which allows you to stop the script execution at the next executed JavaScript statement. This feature can also be enabled via the keyboard shortcut Ctrl+Alt+B.
So, just hit the keyboard shortcut once the animation is at the point when you want to inspect it.
Break on HTML mutation
The HTML panel has a Break On Mutate button (), which allows you to stop the script execution at the next HTML mutation.
There are also more fine grained options to stop at the mutation of a specific element, which are available within the context menu of the elements. Those options are:
In your case Break On Attribute Change may be the right choice in case the animation changes the CSS within the style
attribute of the element.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With