John wrote:

As I'm iterating through DOM HTML nodes I want to determine if that
particular node is set up to handle events (i.e. onclick, etc.), but I
can not figure out how to do so. Ideally I'd like to know exactly what
event they handle but just knowing if they handle events at all would
probably be good enough. I've tried things like QI'ing to a
nsIDOMEventTarget and nsIDOMEventReceiver thinking that only nodes with
an actal handler would succeed but every HTML DOM node seems to support
those. All the methods available seem to either involve adding or
removing event handlers (nsIEventTarget supports AddEventListener and
RemoveEventListener) but nothing like the obvious "GetEventListener".

You are right, in DOM Level 2 as implemented by Mozilla you can add and remove event listeners but there is no way to enumerate attached event listeners or to check whether any event listeners are attached.


DOM Level 3 Events has a method hasEventListenerNS but I don't think any versions of Mozilla implement DOM Level 3 Events.

--

        Martin Honnen
        http://JavaScript.FAQTs.com/
_______________________________________________
Mozilla-xpcom mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to