D
Darko
Hi,
I have a problem that seems to be related to DOM latency in executing
instructions. How I see the situation, if one line of code produces a
lot of inner instructions, then the engine is slowly executing them
while allowing the following lines of code to be executed as well.
I had similar problems earlier when I tried to put elements into an
existing container on the page, rendering the new elements on the fly.
I solved the problem by first generating the whole container in memory
and then inserting it into a document subtree. But now I have the same
problem, which can be seen in the following pseudo code:
// GENERATE A BIG OBJECT IN MEMORY
// RESTRUCTURE THE BIG OBJECT BY REARRANGING ITS (BIG) SUBOBJECTS
// USE THE BIG OBJECT IN RENDERING THE PAGE
It seems that restructuring the big object doesn't finish before its
elements are used in the next phase, rendering the page, and what we
get is partially correct data on the page, and partially the data from
previous data order in the object. I tried to prove to myself that
this is what is happening, by making a slight time delay between the
second and the third phase in the above pseudo-code, e.g. 1 sec., and
it seems to be working - all the data on the page is correctly
displayed.
Now my question is: if this is true, and the mechanism works as I
described it, how do I correct the code? I don't think there's some
way of "flushing" the instructions to make sure they're all completely
executed, but maybe there is? Do you have some other way of solving
the problem, or do you have an advice for avoiding it?
Thank you for any answer or idea,
Darko
I have a problem that seems to be related to DOM latency in executing
instructions. How I see the situation, if one line of code produces a
lot of inner instructions, then the engine is slowly executing them
while allowing the following lines of code to be executed as well.
I had similar problems earlier when I tried to put elements into an
existing container on the page, rendering the new elements on the fly.
I solved the problem by first generating the whole container in memory
and then inserting it into a document subtree. But now I have the same
problem, which can be seen in the following pseudo code:
// GENERATE A BIG OBJECT IN MEMORY
// RESTRUCTURE THE BIG OBJECT BY REARRANGING ITS (BIG) SUBOBJECTS
// USE THE BIG OBJECT IN RENDERING THE PAGE
It seems that restructuring the big object doesn't finish before its
elements are used in the next phase, rendering the page, and what we
get is partially correct data on the page, and partially the data from
previous data order in the object. I tried to prove to myself that
this is what is happening, by making a slight time delay between the
second and the third phase in the above pseudo-code, e.g. 1 sec., and
it seems to be working - all the data on the page is correctly
displayed.
Now my question is: if this is true, and the mechanism works as I
described it, how do I correct the code? I don't think there's some
way of "flushing" the instructions to make sure they're all completely
executed, but maybe there is? Do you have some other way of solving
the problem, or do you have an advice for avoiding it?
Thank you for any answer or idea,
Darko