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

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 UTC