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

Putting EventTarget on the prototype chain

From: Dominic Cooney <dominicc@google.com>
Date: Wed, 15 Jun 2011 22:24:58 +0900
Message-ID: <BANLkTinq5pF=sWLznE2eaLQeRz1jTQAmpA@mail.gmail.com>
To: www-dom@w3.org
Cc: weinig@apple.com, mjs@apple.com, cam@mcc.id.au, ms2ger@gmail.com, annevk@opera.com
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?)

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.

Dominic
Received on Wednesday, 15 June 2011 14:04:51 GMT

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