CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   DOM and JSON scripting (http://www.codingforums.com/forumdisplay.php?f=15)
-   -   Retrieve added events? (debug purposes) (http://www.codingforums.com/showthread.php?t=32316)

Choopernickel 01-28-2004 04:36 PM

Retrieve added events? (debug purposes)
 
While debugging a script, I found that I need to try and verify which if any event listeners are added to an event target, and looking at the standard event handler assignment yields undefined. For example:

Code:

var el = document.getElementById('el');
try {
  el.addEventListener('click', fnRef, false);
} catch (er) {
  el.attachEvent('onclick', fnRef);
}
alert(el.onclick); // alerts undefined

Is there any way to access the event stack for an event target? I can't tell if my events are being added, because they show no sign of execution; yet I don't know how to verify that they are indeed added.

Thanks in advance.

liorean 01-28-2004 04:51 PM

There is no accessible list of the event handlers, no. In some areas the DOM event model has holes large enough to get an Airbus through. The event handler has been assigned because no exception has been thrown. To try to see whether they work, trigger the even and let each event handler report to you.


All times are GMT +1. The time now is 05:49 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.