- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Tue, 18 Jan 2005 18:56:44 -0600
- To: Peter Sorotokin <psorotok@adobe.com>
- CC: Jon Ferraiolo <jon.ferraiolo@adobe.com>, Cameron McCormack <cam-www-svg@aka.mcc.id.au>, www-svg@w3.org
Peter Sorotokin wrote:
>>>> 2) That the implementation is keeping the event listeners for the
>>>> two types in
>>>> separate lists (is this desirable? Should registering a
>>>> listener for both
>>>> types involved make it get the event twice?).
>>>
>>> You can do it per-listener rather than on per-list basis; but I'd
>>> keep two separate lists.
>>
>>
>> In other words, a listener registered for both event names would
>> indeed get the event twice?
>
> No, in this case each event listener entry in the list would have to
> store an event type for which it was registered (also would be needed
> for unregistering).
I'm sorry, but I think you lost me. Say I have an event listener named
"listener" and an event target named "target". We have our two event types
"type1" and "type2". I execute the following code:
target.addEventListener("type1", listener, false);
target.addEventListener("type2", listener, false);
when the event fires, how many times will my listener's handleEvent method be
called? Please note the provisions on addEventListener for registering
identical listeners.
Further, what is the behavior of:
target.addEventListener("type1", listener, false);
target.removeEventListener("type2", listener, false);
?
The answers to these questions should be clearly documented in the specification
of what it means for the two event names to be "equivalent".
-Boris
Received on Wednesday, 19 January 2005 00:59:05 UTC