[whatwg] Exposing EventTarget to JavaScript

Boris Zbarsky bzbarsky at MIT.EDU
Fri Apr 24 14:46:03 PDT 2009

Alex Russell wrote:
> Most of the JS object graphs that you'll see in the wild either
> represent data hierarchies (wherein updates might trigger a UI change)
> or wrapped sets of DOM nodes as a way to make up for the fact that you
> can't freaking subclass Element from JS. In the latter case, it's
> natural to need it to keep up the facade. In the former, it's a
> performance convenience.

Agreed for the latter case (though at that point whatever is doing the 
wrapping can also handle forwarding the listener sets to the real DOM 

I'm not sure what the performance issue with the former case is.  Can 
you elaborate?

>> Possibly for good reasons?  In some implementations the document is in fact
>> baked into the event for various security purposes.
> I think individual call sites overriding their dispatch is sane, but
> hopefully uncommon.

I'm not sure how that relates to what I said...

>> It's not really clear to me what the benefits of using the (rather
>> suboptimal, from the JS point of view) DOM EventTarget API for generic JS
>> callback dispatch are.
> I don't think the proposal would be to use it as-is.



More information about the whatwg mailing list