W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2008

Re: ISSUE-2 (OnFoo Attributes): Event Handler Attributes (onfoo Attributes) and Add/Remove Event Listener [DOM3 Events]

From: Jonas Sicking <jonas@sicking.cc>
Date: Wed, 11 Jun 2008 13:29:15 -0700
Message-ID: <4850359B.4050805@sicking.cc>
To: Maciej Stachowiak <mjs@apple.com>
CC: Web Applications Working Group WG <public-webapps@w3.org>

Maciej Stachowiak wrote:
> 
> 
> On Jun 11, 2008, at 11:51 AM, Web Applications Working Group Issue 
> Tracker wrote:
> 
>>
>> ISSUE-2 (OnFoo Attributes): Event Handler Attributes (onfoo 
>> Attributes) and Add/Remove Event Listener [DOM3 Events]
>>
>> http://www.w3.org/2008/webapps/track/issues/
>>
>> Raised by: Doug Schepers
>> On product: DOM3 Events
>>
>> Should Event Handler attributes (so-called 'onfoo attributes') be 
>> exposed in the  Add/RemoveEventListener interface?
>>
> 
> I don't think any browser exposes these currently via 
> addEventListener/removeEventListener, but they do participate in the 
> event dispatch order. Another way to look at it is: they are added, but 
> the function created from the attribute is not added directly, it is 
> wrapped with an event listener that cannot be observed from JavaScript.

I don't think they should be exposed.

Additionally, how would you deal with someone doing:

elem.onfoo = myFunc;
elem.removeEventListener("foo", myFunc, false);

Would elem.onfoo still be myFunc? That would seem strange. Ideally you 
would probably want to null out elem.onfoo, however that would require 
lots of specialcasing in the event engine.

Additionally, the myFunc function really couldn't be the eventlistener 
as it needs to be wrapped in order to deal with return values etc.

/ Jonas
Received on Wednesday, 11 June 2008 20:32:53 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:25 GMT