Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome DevTools: setting a breakpoint on document scroll change?

Sometimes, in a large clientside webapp, it's necessary to identify which line of code has scrolled the document with a scrollTo() call (or if this is even the cause of the scroll*).

Is there any Chrome DevTools feature which will break JS execution on a window scroll? I'm imagining a feature similar to the DOM Breakpoints feature.

* Scrolling can also happen for other reasons, such as text input in an offscreen <input>.

like image 669
aaaidan Avatar asked May 18 '15 04:05

aaaidan


People also ask

How do I debug a scroll event in Chrome?

You can use a JavaScript event listener breakpoint. In the sources tab for Chrome developer tools, locate the "Event Listener Breakpoints" and then the "scroll" breakpoint is located under "Control".

How do I add a conditional breakpoint in DevTools?

Add a conditional breakpoint by right clicking a line number, selecting Add Conditional Breakpoint , and entering an expression. Note: Because the conditional breakpoint simply evaluates an expression, you can add useful logging statements within the expression.


1 Answers

You can use a JavaScript event listener breakpoint. In the sources tab for Chrome developer tools, locate the "Event Listener Breakpoints" and then the "scroll" breakpoint is located under "Control".

How to add event breakpoint

like image 188
Filip Grace Avatar answered Sep 17 '22 15:09

Filip Grace