Re: SVG 1.2 Raw Socket impl. in JavaScript

Hi Jan,

Jan-Klaas Kollhof wrote:

> How do animations work? They run in a seperate thread,
> don't they? I can have my animation running and a long
> loop in JS at the same time. And if the animation
> should fire an event then it is nicely appended to the
> executen of the script. Once my loop is done and there
> is nothing else to execute the event is dispatched and
> the script for the event is run.
> Maybe I am completely missing something?

    I think so. :)

    I can't speak directly for the Adobe implementation
but in the Batik implementation all access/manipulation
of the DOM is done in one thread.  So in your example
it would not be possible for animation to run (which
manipulates the DOM/CSS) while the script is executing.

    This has been my experience with Adobe as well,
for example if you have a while loop that updates the
'x' attribute of the rect for ever, you will never get
any renderings other than the first one.  This is
because the script never 'releases' the DOM so the
rendering engine can get in and do a rendering.

    You might say - well why doesn't it just take
control?  The simple answer is that this would force
people to explicitly bracket their code so for example
when you update the x, then y, then fill, then stroke
attributes of a rectangle you don't end up with a
rendering 1/2 way through.   There are actually
interfaces to turn rendering on/off in SVG but I
have never seen a single piece of script that
uses them :)

    There are also issues with 'long lived' DOM objects
like node lists, when you may have multiple threads
operating on the DOM tree at the same time.

Received on Wednesday, 17 March 2004 05:53:01 UTC