Re: SVG12: DOM-based animation

* Andrew Shellshear wrote:
>Bjoern Hoehrmann wrote:
>>* Andrew Shellshear wrote:
>>>>>  <handler type="application/ecmascript" ev:event="timer">
>>>>>        if (evt.target == mytimer)
>>>>>        {
>>>>>        showAndGrowElement();
>>>>>        }
>>>>>  </handler>
>>>>
>>>>This is one of the reasons why the example can't work as expected, the
>>>>'timer' event is only ever dispatched to the event listeners registered
>>>>on the Timer object, not to any node in the document. At least the draft
>>>>does not mention that.
>>>
>>>We have added the following to the description of the Timer event:
>>>
>>>This event is only applicable to 'svg' elements.
>>>The target of the event is the 'svg' element.
>>
>>That would make sense only with major changes to the 'Timer' interface;
>>could you elaborate on these changes? How, for example, with this model,
>>would one distinguish between two 'timer' events from different Timer
>>objects?
>
>I apologise in advance if I'm not quite getting your point (and I suspect
>I'm not), but the example above shows how you would distinguish between two
>timer events from different Timer objects.  In particular, the line:
>
>if (evt.target == mytimer)

mytimer is a Timer object as returned by createTimer(), while evt.target
is an EventTarget that identifies the target of the event; per the text
you've added, the target can only be an SVGSVGElement and createTimer()
does not return an SVGSVGElement, so this will never be true. I thought
the correct way to listen for 'timer' events is to

  function handler(evt) { ... }

  mytimer.addEventListenerNS(
    "http://www.w3.org/2001/xml-events", "timer", handler, false, null
  );

<handler> cannot be used because the 'timer' event will never make it
into the document tree, authors would have to re-route the event by
themself, using facilities not available in SVG Tiny 1.2. It would be
possible to say that Timer objects dispatch the timer event to the
SVGSVGElement (which would be complex and complicated to implement, I
don't think that would be a good idea with the current model), but then
there would be no way to distinguish Timers.
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 

Received on Tuesday, 9 May 2006 15:35:50 UTC