Re: Putting EventTarget on the prototype chain

On Wed, 15 Jun 2011 15:24:58 +0200, Dominic Cooney <dominicc@google.com>  
wrote:
> There was a thread on webkit-dev recently (starting at
> <https://lists.webkit.org/pipermail/webkit-dev/2011-June/017024.html>)
> about changing WebKit’s JavaScript bindings to put EventTarget on the
> prototype chain for every event target. The conclusion of the thread
> on webkit-dev was that, WebKit implementation issues aside, we needed
> more discussion and www-dom is a better venue for that.
>
> Here is a brief summary of the opinions and observations of the earlier  
> thread:
>
> DOM Core is deliberately moving EventTarget into the prototype chain
> for DOM nodes, and a bunch of other specs including Notifications,
> Indexed DB, SVG and XHR already specify it this way too (was this by
> accident or design?) However there are still many specs that specify
> EventTarget as a mixin. Which way are the specs going? (Is this a
> better question for public-webapps?)

Maybe it should be posed on public-webapps, yes. It was deliberate for DOM  
Core and XMLHttpRequest. Some people preferred that approach and I tried  
to apply it consistently. Since it is not completely baked I have not  
pursued this change in other specifications thus far.


> Putting EventTarget on the prototype chain makes it easier to hook
> addEventListener/removeEventListener/dispatchEvent by monkeypatching
> EventTarget.prototype, and makes it easier to identify what things are
> event targets. However EventTarget is really an abstract interface,
> and hooking it globally might be of limited utility.


-- 
Anne van Kesteren
http://annevankesteren.nl/

Received on Friday, 17 June 2011 16:09:06 UTC