Re: Introspection on events

On 11/26/2010 05:47 AM, Brett Zamir wrote:
> Hi,
>
> My apologies if this is or has been well covered, but I'd like to know
> whether there has been consideration for allowing introspection of
> events already attached to elements or objects?

I guess you mean "event listeners already added to elements".

And yes, this has been discussed earlier.

>
> I'd like to be able to get the event types, attached function(s),
> whether capturing or not, etc., and possibly also access which events
> could come through the element via bubbling, or precede it by capturing.
>
> I think this could be useful in IDEs, during debugging (and in tools
> such as Firebug),
IDEs and tools like Firebug can use browser specific APIs. No
need to expose everything to web content.
(Firebug, or at least one its extensions uses
http://mxr.mozilla.org/mozilla-central/source/content/events/public/nsIEventListenerService.idl
to look at which listeners are added to an event target)




> and also assist when one wishes to dynamically remove
> all events on an element. No doubt there could be a good number of other
> interesting use cases.
Well, if a web page wants to remove all the listeners it has added, it
sure knows what those listeners are.

There are listeners which web page should not get access to.
For example the listeners added by UA, or some extension or
Greasemonkey.

>
> (This might be especially handy if Mozilla's toSource() could become
> standardized as well, even if it isn't able to be used to rebuild
> closures.)
You mean toSource() in nsIEventListenerInfo? Please file a bug for
the issue you're seeing.


-Olli



>
> thank you,
> Brett Zamir
>
>
>

Received on Friday, 26 November 2010 10:02:04 UTC