Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javascript break on first line

I'm currently using Firebug to debug web applications.

Typically, when we would debug an application, we must follow theses steps:

  1. Find the relevant code in the debugger's code view pane.
  2. Set a breakpoint where we think interesting things may occur.
  3. Reload the page in the browser OR click on a button (or other component) which is controlled by JavaScript.

My question: is there a way to tell the debugger to break on the next JavaScript line to be executed ?

In other words: I load my page, I set an option in my debugger, I click on a button (which is controlled by JavaScript) and my debugger will break on the line which is executed (the one who catches the button click).

Typically, in an application with multiple scripts where is is difficult to find where the interesting thing is.

Thanks in advance

like image 528
Kjnokeer Avatar asked Nov 29 '15 20:11

Kjnokeer


People also ask

What is a break point in JavaScript?

In the debugger window, you can set breakpoints in the JavaScript code. At each breakpoint, JavaScript will stop executing, and let you examine JavaScript values. After examining values, you can resume the execution of code (typically with a play button).

What are DOM breakpoints?

DOM Breakpoints are useful to break on DOM mutation events, such as when a node is removed, modified, or its attributes are changed. You can view all current DOM breakpoints on the DOM Breakpoint tab.

How to skip a line while debugging in Visual Studio?

You can also click on the line you want to skip to and hit Ctrl+F10 (Run to Cursor). It will jump directly to that line.


1 Answers

The debugger doesnt work the you wanted it to be. In Chrome dev tools, generic breakpoints are just generic all rules on all corresponding elements! To debug a click in a certain Button you need to find listener that handles click event on your button particularly. Locate the listener script and add a breakpoint and work frim there.

like image 68
KQI Avatar answered Sep 25 '22 14:09

KQI