发展真快啊 几个月前找这个问题还没有答案 现在chrome和firebug都给了答案
http://stackoverflow.com/questions/4672301/getting-an-elements-eventlisteners
http://stackoverflow.com/questions/4672301/getting-an-elements-eventlisteners
In safari's (and chrome's) element inspector there's an "Event Listeners" section (in the right frame of the elements tab) that show's the Event Listeners in the document. Is there anything similar in firebug? Also, is it possible to get an element's event listeners using javascript (likeelmnt.onclick
, but should work for events added withaddEventListener()
as well)?This is available for firebug:
http://getfirebug.com/wiki/index.php/Firebug_Extensions#Eventbug
For your second question, is it possible to get the events added via addEventListener in javascript? Generally it is not. That add-on uses
eventlistenerservice
you would need elevated privileges, a signed script and it would still only work in Firefox.Eventbug
Eventbug is a Firebug extension that lists all of the event handlers on the page grouped by event type...
没有评论:
发表评论