From FirebugWiki
Revision as of 07:40, 16 July 2013 by Honza (Talk | contribs) (Created page with "Returns all the event listeners registered for specific node. == Syntax == <source lang="javascript"> getEventListeners(node) </source> == Parameters == === node === The elemen...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Returns all the event listeners registered for specific node.





The element (event target) for which registered listeners are returned.


An example of a web page that registers three listeners:

document.body.addEventListener("click", function onClick1() {}, true);
document.body.addEventListener("click", function onClick2() {}, true);
document.body.addEventListener("mousemove", function onMouseMove1() {}, true);

This is what you execute on the Command Line.


The Console panel result is a simple object an array for each event type (e.g. "click" or "mousemove"). The following screenshot shows that there are two click and one mousemove registered listeners on document.body element.


If you want to see more about registered listeners click on the green object in the Console panel and you'll navigated to the DOM panel. See the next screenshot.


Every item in the arrays describes particular listener. You can see if useCapture is set and name of the function used as the listener handler. If you click the function you'll be navigated to the Script panel to see its source code.

See also