Use breakpoints to pause your JavaScript code. This guide explains each type of breakpoint that is available in DevTools, as well as when to use and how to set each type. For a hands-on tutorial of the debugging process, see Get Started with Debugging JavaScript in Microsoft Edge DevTools.
The most well-known type of breakpoint is line-of-code. But line-of-code breakpoints may be inefficient to set, especially if you do not know exactly where to look, or if you are working with a large codebase. You may save yourself time when debugging by knowing how and when to use the other types of breakpoints.
Aug 25, 2010 How To Connect Two Routers On One Home Network Using A Lan Cable Stock Router Netgear/TP-Link - Duration: 33:19. Richard Lloyd Recommended for you.
Breakpoint Type | Use This When You Want To Pause.. |
---|---|
Line-of-code | On an exact region of code. |
Conditional line-of-code | On an exact region of code, but only when some other condition is true. |
DOM | On the code that changes or removes a specific DOM node, or the children. |
XHR | When an XHR URL contains a string pattern. |
Event listener | On the code that runs after an event, such as click , runs. |
Exception | On the line of code that is throwing a caught or uncaught exception. |
Function | Whenever a specific command, function, or method is run. |
Use a line-of-code breakpoint when you know the exact region of code that you need to investigate. DevTools always pauses before this line of code is run.
To set a line-of-code breakpoint in DevTools:
A line-of-code breakpoint set on line 30
Run the debugger
method from your code to pause on that line. This is equivalent to a line-of-code breakpoint, except that the breakpoint is set in your code, not in the DevTools UI.
Use a conditional line-of-code breakpoint when you know the exact region of code that you need to investigate, but you want to pause only when some other condition is true.
To set a conditional line-of-code breakpoint:
Enter
to activate the breakpoint. An icon next to the line number column.A conditional line-of-code breakpoint set on line 34
Use the Breakpoints pane to disable or remove line-of-code breakpoints from a single location.
The Breakpoints panel showing two line-of-code breakpoints: one on line 16
of get-started.js
, another on line 33
Deactivated breakpoints in the Breakpoints pane are disabled and transparent
Use a DOM change breakpoint when you want to pause on the code that changes a DOM node or the children.
To set a DOM change breakpoint:
The context menu for creating a DOM change breakpoint
Subtree modifications. Triggered when a child of the currently-selected node is removed or added, or the contents of a child are changed. Not triggered on child node attribute changes, or on any changes to the currently-selected node.
Steinberg hypersonic 2 vst plugin full download. Every parameter would now be able to be altered effectively and easily. With Hypersonic 2 VST 64 Piece now you are additionally engaged of including or expelling components from the parts rather than simply quieting it. With everything taken into account Hypersonic 2 VST 64 Piece is a monumental sound module which can be utilized for upgrading your sounds enormously.
Attributes modifications: Triggered when an attribute is added or removed on the currently-selected node, or when an attribute value changes.
Node Removal: Triggered when the currently-selected node is removed.
Use an XHR breakpoint when you want to break when the request URL of an XHR contains a specified string. DevTools pauses on the line of code where the XHR runs the send()
method.
Note
This feature also works with Fetch API requests.
One example of when this is helpful is when you see that your page is requesting an incorrect URL, and you want to quickly find the AJAX or Fetch source code that is causing the incorrect request.
To set an XHR breakpoint:
Enter
to confirm.Creating an XHR breakpoint in the XHR Breakpoints for any request that contains org
in the URL
Use event listener breakpoints when you want to pause on the event listener code that runs after an event is fired. You are able to select specific events, such as click
, or categories of events, such as all mouse events.
Creating an event listener breakpoint for deviceorientation
Use exception breakpoints when you want to pause on the line of code that is throwing a caught or uncaught exception.
Click the Sources tab.
Click Pause on exceptions . The icon turns blue when enabled.
Figure 8
The Pause on exceptions button
Optional. Check the Pause On Caught Exceptions checkbox if you also want to pause on caught exceptions, in addition to uncaught ones.
Paused on an uncaught exception
Run the debug(method)
method, where method
is the command, function, or method you want to debug, when you want to pause whenever a specific function is run. You may insert debug()
into your code (like a console.log()
statement) or run the method from the DevTools Console. debug()
is equivalent to setting a line-of-code breakpoint on the first line of the function.
DevTools throws a ReferenceError
if the function you want to debug is not in scope.
Ensuring the target function is in scope is tricky if you are running the debug()
method from the DevTools Console. Here is one strategy:
debug()
method in the DevTools Console while the code is still paused on your line-of-code breakpoint.Note
Portions of this page are modifications based on work created and shared by Google and used according to terms described in the Creative Commons Attribution 4.0 International License.
The original page is found here and is authored by Kayce Basques (Technical Writer, Chrome DevTools & Lighthouse).
This work is licensed under a Creative Commons Attribution 4.0 International License.