By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,377 Members | 1,655 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,377 IT Pros & Developers. It's quick & easy.

removeEventListener when you don't know the object or function name

P: n/a
Is there a way to call removeEventListener when you don't know what
events may have been added?

With something like
object.onclick = blah;
I could run through every element in the page, search for onclick and
set it to null.

When people use addEventListener and don't keep a record of the events
they add it to I don't know how to find them.

Andrew Poulos
Sep 1 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
* Andrew Poulos wrote in comp.lang.javascript:
>Is there a way to call removeEventListener when you don't know what
events may have been added?
No. You could try to override the addEventListener function before any
listener is added and use that information, or you could generate a list
of "all" probable event names and use them all, but other than that this
is not possible. Browser-internal APIs might help you, if this is for a
browser extension of some sort.
--
Björn Höhrmann · mailto:bj****@hoehrmann.de · http://bjoern.hoehrmann.de
Sep 1 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.