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

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

From: Jonas Sicking <jonas@sicking.cc>
Date: Wed, 09 Apr 2008 15:48:47 -0700
Message-ID: <47FD47CF.907@sicking.cc>
To: Travis Leithead <travil@windows.microsoft.com>
CC: Anne van Kesteren <annevk@opera.com>, Doug Schepers <schepers@w3.org>, Web API public <public-webapi@w3.org>

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 Wednesday, 9 April 2008 22:51:11 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 April 2008 22:51:12 GMT