Closed Bug 665933 Opened 13 years ago Closed 9 years ago

[highlighter] investigate showing elements listening to mouse & key events

Categories

(DevTools :: Inspector, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1044932

People

(Reporter: paul, Unassigned)

References

Details

Attachments

(1 file)

Mike Ratcliffe suggested this: > let eventListenerService = > Components.classes["@mozilla.org/eventlistenerservice;1"] > .getService(Components.interfaces.nsIEventListenerService); > > let elt = content.document.getElementById(aNode.id); > > eventListenerService .getListenerInfoFor(elt).getDebugObject(); > > I am fairly certain that this gives access to some useful event info > ... the only problem is that the debugger needs to be running in > order to use it.
The debugger doesn't need to be running if you only need to list the listeners attached to an element. You can use the following code for that: let eventListenerService = Components.classes["@mozilla.org/eventlistenerservice;1"] .getService(Components.interfaces.nsIEventListenerService); let elt = content.document.getElementById(aNode.id); let result = eventListenerService.getListenerInfoFor(elt); If you want to do more than simply listing them then the debugger needs to be running.
See also following Firebug extension that uses nsIEventListenerService to display event handlers. http://code.google.com/p/fbug/source/browse/#svn%2Feventbug%2Fbranches%2Feventbug0.1 Honza
still want something like this.
Component: Developer Tools → Developer Tools: Inspector
On mouse over you can see all events types / handlers.
the firebug implementation lives in the following places. https://github.com/firebug/firebug/blob/master/extension/content/firebug/lib/events.js#L588 https://github.com/firebug/firebug/blob/master/extension/content/firebug/console/commands/getEventListeners.js#L205 we could rip it out and put it into the web console, then use it to spice up the inspector
(In reply to flying sheep from comment #6) > the firebug implementation lives in the following places. > > https://github.com/firebug/firebug/blob/master/extension/content/firebug/lib/ > events.js#L588 > https://github.com/firebug/firebug/blob/master/extension/content/firebug/ > console/commands/getEventListeners.js#L205 > > we could rip it out and put it into the web console, then use it to spice up > the inspector Thanks. elService being: > let eventListenerService = Cc["@mozilla.org/eventlistenerservice;1"] > .getService(Ci.nsIEventListenerService);
Or we could reuse the code in the debugger (maybe even move it to devtools/shared/).
(In reply to Panos Astithas [:past] from comment #8) > Or we could reuse the code in the debugger which lives where? (i’d like to create an extension like eventbug for the web console, so i’d like to see all prior art here for inspiration ☺)
thanks!
We've had event information in the inspector for a while now, I think since bug 1044932.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: