W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2012

Re: [DOM4] EventTarget as first class citizen

From: Jake Verbaten <raynos2@gmail.com>
Date: Wed, 29 Feb 2012 20:00:14 +0000
Message-ID: <CAMCMjp2OCJ94duWYZzo-FzjQMJK-6Z0B7yOub97VjWNNxy_31Q@mail.gmail.com>
To: Jonas Sicking <jonas@sicking.cc>
Cc: Marcos Caceres <w3c@marcosc.com>, Anne van Kesteren <annevk@opera.com>, www-dom@w3.org
On Wed, Feb 29, 2012 at 7:40 PM, Jonas Sicking <jonas@sicking.cc> wrote:

> On Wed, Feb 29, 2012 at 7:21 PM, Jake Verbaten <raynos2@gmail.com> wrote:
> >> For 1, I don't know what that would look like, but something like
> >> ECMAScript's Object.create() would be a nice pattern:
> >>
> >> var et = EventTarget.create(someObject);
> >
> > We don't actually need that, we just need to glare at browser vendors
> until
> > they implement the IDL. Once that is done then
> >
> > `var et = Object.create(EventTarget.prototype)`
> >
> > Should "just work" assuming the methods on EventTarget.prototype are
> generic
> > and flexible enough to work on any object.
> I don't see how they could be. Where would the functions store the
> internal state such as the set of event listeners for example?

"Append an event listener to the associated list of event listeners" DOM4
does not specify how the associated list of event listeners should be
stored. There are a few candidates that can make this generically work with

 - as properties this._events on the object
 - as a WeakMap or Map structure
 - as some clever association that works generically done in the C++ layer

Making this association generic should be the only thing neccessary for
these methods to "just work" on objects
Received on Wednesday, 29 February 2012 20:00:46 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:18 UTC