New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Oct 2013
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

DevTools: improve event listener object

Project Member Reported by paulir...@chromium.org, Oct 21 2013

Issue description

Let's delete an event listener:

var listener = getEventListeners(document).mousewheel[0];
document.removeEventListener("mousewheel", listener.listener, listener.useCapture);

It would be ideal if event type was exposed in the object so you could reference it.

    getEventListeners(document).mousewheel[0];
    document.removeEventListener($_.type, $_.listener, $_.useCapture); 

Some added sugar would be a remove method that automates this second process:

    $_.remove()



 
Relatedly, 

I'll  point out that Firebug offers a fn.%handler attach point to let event binding abstractions point to the authored handler. 
https://getfirebug.com/wiki/index.php/GetEventListeners#But_I.27m_only_seeing_library_wrapper_functions.3F

This convention never seemed to get adoption however: https://github.com/search?l=javascript&q=%25handler&ref=cmdform&type=Code
So I don't think this part would be wise for us to adopt at this time.


Another opportunity is to provide a Context Menu item to remove the event listener,
Owner: aandrey@chromium.org
Status: Assigned
Project Member

Comment 4 by bugdroid1@chromium.org, Oct 28 2013

The following revision refers to this bug:
    http://src.chromium.org/viewvc/blink?view=rev&rev=160713

------------------------------------------------------------------------
r160713 | aandrey@chromium.org | 2013-10-28T10:57:58.903071Z

Changed paths:
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/inspector/console/command-line-api-getEventListeners.html?r1=160713&r2=160712&pathrev=160713
   M http://src.chromium.org/viewvc/blink/trunk/Source/core/inspector/InjectedScriptSource.js?r1=160713&r2=160712&pathrev=160713
   M http://src.chromium.org/viewvc/blink/trunk/LayoutTests/inspector/console/command-line-api-getEventListeners-expected.txt?r1=160713&r2=160712&pathrev=160713

DevTools: Improve CommandLineAPI's getEventListeners result.

Expose "type" string and "remove()" function.

BUG= 309524 
R=caseq, pfeldman

Review URL: https://codereview.chromium.org/48363002
------------------------------------------------------------------------
Status: Fixed

Sign in to add a comment