0

I'm working on trying to find a defect in an angular application in the javascript being used to scroll a page. Person clicks link, page scrolls. Simple.

Alas, I have no idea what functions are actually being called when a user clicks the link and given this app consists of dozens and dozens (and dozens) of separate files, I'm having trouble finding what's going on.

I've read about using breakpoints and setting them up via the SOURCES tab in devtools. However, regardless of which of the many JS files I open in there, I never get any breakpoint options to check.

Is there a way to see what JS is getting fired with a particular event on the page within Chrome's Devtools?

3
  • You can set a breakpoint by clicking the line number to the left of the line you want to pause before. It will make a little blue arrow. Commented Jun 15, 2018 at 3:55
  • @shiftweave I have no idea what function I'm looking for, let alone which JS file it's in or what line number it's at. None of this is my code. Commented Jun 15, 2018 at 4:02
  • There is an Event Listeners tab in Chrome Dev Tools that lists all the event listeners attached to the various elements. Note though some might link to a library that set the listener (ie if using jQuery will link to the jQuery subsystem) Commented Jun 15, 2018 at 4:18

1 Answer 1

2
  1. Go to Sources tab.
  2. Unfold Event Listener Breakpoints
  3. Unfold Control, check scroll checkbox.
  4. Scroll the page.

Javascript runtime will stop on event listener bound to page scroll and place will be showed in main window under Sources tab. If it's library file (in You case Angular files), right click on the file and Blackbox script. Scroll page again ;)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.