Experimental build with event listener inspection and function source tooltips
By Christian Krebsaleto. Monday, July 9, 2012 3:35:09 PM
Our latest experimental build introduces the ability to inspect JavaScript event listeners from inside the DOM view.
As these new features rely on functionality that's only recently been added to our browser core, they're currently only available if you're running Opera Next.
Elements with an attached event listener are presented with a new icon in the Document view. Hovering the icon opens an overlay with the list of listeners.
Each listener has an entry showing the event type as title. The next line shows if it listens in the bubbling or the capturing phase. If the listener was registered with addEventListener or set as 'on'-event-type its type is 'event target listener'. Listeners set as markup attributes are 'attribute listener'. Hovering that type shows the according listener callback in a function source tooltip.
Breakpoints can be set directly in that tooltip. Clicking the title of the function source tooltip switches to the Scripts tab and highlights the corresponding function in the source file.
The last line of a listener entry in the overlay shows where the listener was registered. Again, clicking this line switches to the Scripts tab and highlights the corresponding line in the source file.
To complement the inspection functionality in the Document view, there is also a new Listeners side panel, which gives an overview of all listeners that are currently active, ordered by event type. Each of the event types type can be expanded to show all nodes with an according listener.
The panel provides a static snapshot of registered event listeners – but as event listeners can be programmatically added, modified or removed frequently, the Listeners panel also features an update button which will refresh the snapshot view.
As a bonus, the new function source tooltips used in the event listener overlay above have also been added to other parts of the JavaScript source view. This can be handy to set breakpoints directly in a callback.
We hope that these new features will be a useful addition for JavaScript developers. As always, we value your feedback and suggestions.


Patrick O'Reillypaddy2k # Monday, July 9, 2012 4:19:09 PM
Martin KadlecBS-Harou # Monday, July 9, 2012 4:24:42 PM
The first problem is that even when I reload the site with opened dragonfly the popup still says "< missing javascript source file >" instead of "added in something.html". When I click on it it offers me to reload the site again, but that doesn't help either. (Using the latest and only 12.50 snapshot)
The second thing is, that I'm not sure if pop-up is the best idea to handle the element-related events. The pop-up hides some other parts of the html code and with higher amount of events it might be quite uncomfortable to work with it. One way to solve it might be replacing the pop-up window on hover of the "ev" with "onclick" event that would take mo to the "Listeners" panel, but with the list of events related only to the element.
quarkdrunkensurgeon # Monday, July 9, 2012 4:38:56 PM
svdb0 # Monday, July 9, 2012 4:51:34 PM
And since you're asking for suggestions: something like this to view timers (setTimeout/setInterval) could come in handy as well.
IllusionMH109th # Monday, July 9, 2012 6:03:59 PM
Awesome feature.
Would be nice to add breakpoints to listeners code in popup, as described in last feature in this post, even if listener contains only one line.
Originally posted by BS-Harou:
I can confirm this.
I expected that Listeners would be on Scripts tab with ability to quick jump to element in DOM.
BTW It is normal to send bug reports and feature requests to github if it is about experimental branch?
Christian Krebsaleto # Monday, July 9, 2012 6:59:07 PM
Originally posted by 109th:
That's OK, and thanks for the feedback.
Unregistered user # Monday, July 9, 2012 7:11:13 PM
Christian Krebsaleto # Monday, July 9, 2012 10:16:23 PM
Originally posted by BS-Harou:
Do you see that for others than attribute handlers? For those it's somehow expected, also the string needs to be improved and the click handler removed. Just reloading the document still doesn't create source code, that only happens the first time an attribute type listener gets called.
IllusionMH109th # Monday, July 9, 2012 11:27:20 PM
Originally posted by aleto:
In general, I see this string for attribute handlers.
But there is an exception - before page reload(when Scripts tab is empty) I can see this string too. (this is expected behavior for me)
http://img339.imageshack.us/img339/6266/odflisteners.th.png -
Also there is problem with scripts without actual filename (screen from gmail for example)
http://img840.imageshack.us/img840/738/odflisteners2.th.png -
It will be possible to see all listeners just after page reload(even better on Listeners tab opening) in future?
For example: just simulate click on Update button or add checkbox to Listeners tab or settings. Or it will cause bad performance?
Because even on this page after simple reload even attribute handlers aren't seen.
Martin KadlecBS-Harou # Monday, July 9, 2012 11:29:11 PM
Originally posted by aleto:
You are right, the problem is only with attribute handlers! I have found more issues while testing it though!
Go to:
http://files.myopera.com/BS-Harou/files/events1.html
[wtf 1] Open dragonfly and go to the "Listeners" tab in "Document" section. Try to click on the "+" button next to "click". Nothing happens. Why?
[wtf 2] When you clicked on the "+", try to click on the "Update" button. The "click" disappears from the list.
[wtf 3] Now go to any other tab and back. The "updated" button is gone.
IllusionMH109th # Monday, July 9, 2012 11:48:15 PM
Originally posted by BS-Harou:
Confirm all of these issues
Christian Krebsaleto # Tuesday, July 10, 2012 5:51:24 AM
Originally posted by BS-Harou:
Probably all the same bug, will look into it, thanks for reproting!
Daniel Herzogdanfoooo # Tuesday, July 10, 2012 8:20:13 AM
Originally posted by paddy2k:
Thanks for reporting, this is indeed broken in this build.
Unregistered user # Wednesday, July 11, 2012 8:08:47 AM
Mathieu 'p01' HENRIp01 # Wednesday, July 11, 2012 8:55:00 AM
JanGen # Friday, July 13, 2012 12:19:26 PM
While debugging, I often lose track of which tab exactly I'm debugging, especially with cloned tabs. The order of the DF dropdown doesn't seem to resemble the order of tabs in the main window (at least not after reordering).
Can't there be a visual feedback which tab is debugged, by showing the DF icon instead of the favicon, or some other visual feedback on the tab.
Furthermore with cloned tabs, sometimes after reloading DF loses track (after inputting some content in input fields & reloading?) of which item in the dropdown points to which tab, Sometimes two dropdown items point to the same tab
Unregistered user # Friday, July 13, 2012 11:10:00 PM
Unregistered user # Friday, July 13, 2012 11:12:34 PM