Community
Participate
Working Groups
It would be nice to set breakpoints in HTML to catch JS execution in such event listeners as onclick, onload, etc..
It would be possible by using function hook. Looking at the stack trace, stack frame associated with event (e.g. onload) has functionName set to "onload". Unfortunately line breakpoint doesn't work because stack frame has incorrect line number, it's 0 instead of number of line in html file.
Additionally we could block setting line breakpoints in HTML files when not between <script></script> to avoid confusion, however it sounds impossible, e.g. considering dynamically generated HTML.
Created attachment 147771 [details] function breakpoints initial implementation of function breakpoints. It still needs some work to make stepInto/Over/Return buttons work correctly. It might also make sense to have separate breakpoint type for events and separate for functions. In Events breakpoint, user could simply choose from predefined list of all known events, rather than inventing his own names. That's because for event names letter case doesn't matter - onload/onLoad/OnLoad is always onload. Thats different for regular functions names where names case does matter. Later on, some logic could be added, that would try to suggest user which breakpoint is best to use (eventBreakpoint over lineBreakpoint)