Re: DOM Level 3 events

At 10:58 AM 1/18/2005 -0600, Boris Zbarsky wrote:

>Jon Ferraiolo wrote:
>>However, you can register an event listener using either name. Your 
>>handler will get invoked no matter whether you listen to the "error" 
>>event or the "SVGError" event. I would assume that, when your handler 
>>receives the event object, the event name would match the name of the 
>>event to which your event listener was listening. Thus, if you listened 
>>for "SVGError", the event type on the event object would be "SVGError".
>I'm not quite sure how this works...  It seems we're trying to maintain 
>the following invariants here:
>1)  The sme event object is passed to all the listeners involved
>2)  The "type" is a property of the event object
>3)  Different listeners see different types
>So is the type supposed to by changed during event dispatch, then changed 
>back?  This suggestion makes it impossible to simply alias the two event 
>types to each other in the event implementation in the UA,

Surely it is possible. Implementation can temporarily override "public" 
event type to the type before calling the listeners of that type. The only 
drawback is that is if a listener holds an event beyond the duration of the 
handleEvent call, it might see aliased type; but such listener is already 
asking for trouble.


>  which would be the most natural way of implementing two different names 
> for the same event...

Received on Tuesday, 18 January 2005 19:29:36 UTC