W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2011

Re: Putting EventTarget on the prototype chain

From: Anne van Kesteren <annevk@opera.com>
Date: Fri, 17 Jun 2011 18:08:03 +0200
To: www-dom@w3.org, "Dominic Cooney" <dominicc@google.com>
Cc: weinig@apple.com, mjs@apple.com, cam@mcc.id.au, ms2ger@gmail.com
Message-ID: <op.vw79rpau64w2qv@anne-van-kesterens-macbook-pro.local>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:07 GMT