W3C home > Mailing lists > Public > www-svg@w3.org > March 2004

Re: SVG 1.2 Raw Socket impl. in JavaScript

From: Thomas DeWeese <Thomas.DeWeese@Kodak.com>
Date: Wed, 17 Mar 2004 05:52:22 -0500
Message-ID: <40582DE6.1010904@Kodak.com>
To: Jan-Klaas Kollhof <keyjaque@yahoo.com>
Cc: Peter Sorotokin <psorotok@adobe.com>, www-svg@w3.org

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 5 November 2012 23:52:55 GMT