[whatwg] Exposing EventTarget to JavaScript

Boris Zbarsky bzbarsky at MIT.EDU
Fri Apr 24 14:42:09 PDT 2009


Alex Russell wrote:
> Something missing from this (and from Erik's original mail) is the
> ability to enumerate listeners.

This has been brought up before.

1)  There are some serious security concerns here.
2)  It's not clear what the enumeration should actually return.
     EventListener objects?  JS Function objects?  Something else?
     Last I checked people couldn't even agree on this (both have
     pros and cons).

And other than a debugger, I have yet to see a usecase for this.  Do you 
have a specific one in mind?

> Even in the XHR case, adding more than one listener is currently a
> pain.

How so, exactly?

> Part of the goal here would be to make event dispatch across
> lists of listeners as natural in JS as it is in DOM.

The only natural thing in DOM is the event flow from target to root. 
That concept doesn't make much sense in the absence of a linear data 
structure (the list of ancestors, here).

Is your real use case just to call a bunch of listeners in a defined order?

-Boris



More information about the whatwg mailing list