Firefox Developer Edition get all event listeners registered on an element getEventListeners

Viewed 1529

I want to get all the event listeners registered on an element, in JavaScript in the developer tools console.

In Chrome, getEventListeners(domElement) exists.

In Firebug, that apparently exists too. Firebug is discontinued. I found this article which says:

So it’s sad that Firebug is now reaching end-of-life in the Firefox browser, with the release of Firefox Quantum (version 57) next month. The good news is that all the capabilities of Firebug are now present in current Firefox Developer Tools.

Emphasis mine.

However, getEventListeners is not working in my installation of Firefox Developer Edition 78.0b3.

So how do I get a list of event listeners registered on an element in the console?

1 Answers

According to this page: https://bugzilla.mozilla.org/show_bug.cgi?id=1164285 this is being worked on, so getEventListeners is not implemented yet in the new Firefox.

It's possible though to find the element in the Inspector panel, and to the right of it there is an event button, which shows event listeners. You can inspect them and find their location in the code.

Related