getEventListeners returns wrong number of listeners?
Reported by
ovkadu...@gmail.com,
Jan 15 2017
|
||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2982.0 Safari/537.36 Steps to reproduce the problem: Please check out jsfiddle in here https://jsfiddle.net/ovkadurin/sheoje83/6/ as well as animated gif attached. The thing is that getEventListeners shows that there's only one listener when the same listener is bound multiple times. And that is really confusing. Also if selecting the element in the Elements panel and look at the Event Listeners tab on the right, then we can see that there are actually two the same listeners, which is correct. What is the expected behavior? getEventListeners should show correct number of listeners. What went wrong? Bug. Did this work before? N/A Chrome version: 57.0.2982.0 Channel: canary OS Version: 10.0 Flash Version: Shockwave Flash 24.0 r0
,
Jan 15 2017
On the other hand, there is an obvious discrepancy: getEventListeners output is based on the actual DOM listener function reference, but Elements panel Event Listeners tab evidently recognizes jQuery framework and reports both calls as separate listeners (and from the underlying real DOM point of view this is incorrect because the listener function reference is the same).
,
Jan 16 2017
,
Jan 16 2017
wox...@gmail.com, thanks for information! >>>1. there is actually just one DOM listener used inside jQuery internally as you can see by expanding the output of getEventListeners. This single jQuery listener routes the events to the bound elements. Agree. I thought that jQuery just bind the listener directly to the element. >>>2. the Elements panel Event Listeners tab shows two *elements*, not two *listeners* Well. I talked about listeners which are on the right (where there are file names and line numbers). >>> Event Listeners tab evidently recognizes jQuery framework and reports both calls as separate listeners Having the information that the same listener (the one bound by jQuery) will be called multiple times really helps. ----------- Ok. So now I understand that getEventListeners returns the only listeners which are bound directly to the DOM. And there is very helpful option "Framework listeners" in the "Event Listeners" tab, that can show listeners bound by jQuery. So, the "Framework listeners" option (which I haven't known about) does what I need.
,
Jan 16 2017
Actually, it'd reasonable to make getEventListeners return an additional property with framework listeners: this would solve the raised issue and make the function much more useful.
,
Jan 16 2017
wox...@gmail.com, good point!
,
Jan 17 2017
From the discussion in above comment#4 , this seems more like a feature request or extended functioanlity request . @woxxom/ovkadurin-- Could any one of you confirm this , so that we can triage this. Note : Removing Bisect-label, please add if required. Thanks!
,
Jan 17 2017
hdodda@chromium.org, Ok with me.
,
Jan 17 2017
Considering this as a feature request and marking it as Untriaged to get it addressed. Thanks..
,
Jan 17 2017
,
Jan 17 2017
,
Feb 21 2017
Removing Needs-Triage-M57 label based on the above comments #2,4 & 5 and added appropriate milestone for it.
,
Oct 16 2017
|
||||||||
►
Sign in to add a comment |
||||||||
Comment 1 by woxxom@gmail.com
, Jan 15 2017