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

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 UTC