W3C home > Mailing lists > Public > public-webapi@w3.org > April 2008

RE: [DOML3Events] ACTION-267 Proposal for event iterator

From: Travis Leithead <travil@windows.microsoft.com>
Date: Wed, 9 Apr 2008 17:32:08 -0700
To: Jonas Sicking <jonas@sicking.cc>
CC: Anne van Kesteren <annevk@opera.com>, Doug Schepers <schepers@w3.org>, Web API public <public-webapi@w3.org>
Message-ID: <0003CB8B8FE2154EB50431DB2B8F69C002C6E04F83@NA-EXMSG-W601.wingroup.windeploy.ntdev.microsoft.com>
I'll try to dig up some specific use cases.

Yes, the workaround below would work great as well, until we ratify this API :)

-----Original Message-----
From: Jonas Sicking [mailto:jonas@sicking.cc]
Sent: Wednesday, April 09, 2008 3:49 PM
To: Travis Leithead
Cc: Anne van Kesteren; Doug Schepers; Web API public
Subject: Re: [DOML3Events] ACTION-267 Proposal for event iterator

Travis Leithead wrote:
> From your link, it appears the only reason this was dropped was because the folks in discussion at the time thought the only use case for this feature was Accessibility venders (ATs).

It wasn't just dropped because it wasn't needed (because AT doesn't need
to use DOM APIs). It was also dropped since it would mean that internal
code can not use the generic DOM APIs to add event listeners. This is
something that we do a lot in Firefox code and that is done by a lot of
Firefox extensions. See
http://lists.w3.org/Archives/Member/member-webapi/2006Feb/0301.html

and the followups.

I agree that this is something that we could work around if absolutely
needed. I'm definitely an advocate for not designing Web APIs for
internal consumers. However it is always a very nice bonus when public
APIs are also useful internally.

So I too would be interested in hearing more about the use cases here.
Could the following be used as a solution?

oldAddEL = EventTarget.prototype.addEventListener;
Node.prototype.addEventListener = function(type,
   listener, useCapture) {
   if (!this.getUserData("listeners")) {
     this.setUserData("listeners", [], null);
   }
   this.getUserData("listeners").push(listener);
   oldAddEL.call(this, type, listener, useCapture);
}

This should let the page access all listeners added to any node using
getUserData("listeners").

/ Jonas

Received on Thursday, 10 April 2008 00:34:36 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 10 April 2008 00:34:39 GMT