How to debug JavaScript / jQuery event bindings with Firebug or similar tools?

前端 未结 15 1371
一个人的身影
一个人的身影 2020-11-22 06:56

I need to debug a web application that uses jQuery to do some fairly complex and messy DOM manipulation. At one point, some of the events that were bound to particular eleme

15条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-22 07:19

    ev icon next to elements

    Within the Firefox Developer Tools' Inspector panel lists all events bound to an element.

    First select an element with Ctrl + Shift + C, e.g. Stack Overflow's upvote arrow.

    Click on the ev icon to the right of the element, and a dialogue opens:

    Click on the pause sign || symbol for the event you want, and this opens the debugger on the line of the handler.

    You can now place a breakpoint there as usual in the debugger, by clicking on the left margin of the line.

    This is mentioned at: https://developer.mozilla.org/en-US/docs/Tools/Page_Inspector/How_to/Examine_event_listeners

    Unfortunately, I couldn't find a way for this to play nicely with prettyfication, it just seems to open at the minified line: How to beautify Javascript and CSS in Firefox / Firebug?

    Tested on Firefox 42.

提交回复
热议问题